|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL within a Shell Script
Hi,
I need to create a pipe delimited file based on the data in an Oracle table and I need some help/pointers with it. Here is the table structure: tableA: old_id varchar2(255); new_id varchar2(255); cdate date; mdate date; cflag char(1); The shell sript should do the following: 1. connect to the database. 2. set the flag to Z if it is an N. 3. write old_id and a pipe sign. 4. write the new_id. 5. set the mdate to the current date. 6. The cflag which is Z should be set to Y once my file is created. This running Oracle 9 on Solaris 9 OS. Any help would be greatly appreciated. Thank you, Sankar. Note: This is my first post here. I hope my question is acceptable. If not, my apologies in advance. Thanks. |
|
#2
|
|||
|
|||
|
RE: SQL within a Shell Script
Check to if there is a command-line tool for interacting with Oracle. There probably is, and you probably already know what it's called and how to use it. In the Linux world, MySQL and PostgreSQL both have these (they're called mysql and psql, respectively).
If you can utilize the command line tool to execute Oracle SQL statements, then you could create a shell script (bash or whatever) to accomplish your goals. I am not familar with Oracle, but with postgres, the command would look something like this: psql -d yourdbname -U postgres -c "QUERY;" best wishes... |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > SQL within a Shell Script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|