I'm an engineer developer and I need a script at operating system windows, to connect a…
- User
I'm an engineer developer and I need a script at operating system windows, to connect a Oracle data base nad run other script sql. The second script sql must run a select from a table and download the data with format delimited and separated by "|" and save the file with extension .txt with the date of the Operating system host. (windows)
Assistant
To create a script to connect to an Oracle database, run SQL queries, and export data to a delimited text file with the current system date in the filename, you can use the SQL*Plus tool that comes with Oracle Database. Here's an example script:
- Connect to the database with your credentials:
sqlCONNECT your_username/your_password@your_database;- Set the output format to CSV with pipe delimiter:
sqlSET LINESIZE 10000 SET COLSEP '|' SET FEEDBACK OFF SET NEWPAGE NONE SET VERIFY OFF SET ECHO OFF SET TRIMSPOOL ON SET TERMOUT OFF SPFILE OFF IDENTIFIED BY your_password- Run the SQL query to select the data:
sql