Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Unix shell script runing SQL files
Name: richard Date: July 10, 2003 at 12:10:06 Pacific OS: XP CPU/Ram: 128
Comment:
How can I create a Unix shell script that will run individual SQL files having a seperate result file for each SQL file?
An advantage of this is that you don't have to give away your username/password to anyone running 'ps -ef'.
Starting SQL*Plus and connecting to the database is relatively slow though, so if you have a lot of scripts to run you could call several scripts per SQL*Plus session, or set off one session in background as a coprocess.
None of this is great use of the database though. Perl has database connectivity modules that allow you to make a connection programmatically without having to call SQL*Plus (I'm going to have to learn Perl one day). Or you can write a PL/SQL package to output text files, XML and so on.
0
Response Number 5
Name: Richardgd Date: July 18, 2003 at 11:43:55 Pacific
Reply:
Thanks, however I am trying to use this shell script. It works great with one sql file but when I place each file on separate lines it doesn't work. I know it's something minor but I can't figure it out.
This works fine!! #!/bin/ksh sqlplus -s user/password @/var/cri/test.sql exit EOF
Summary: If the .csv file is reasonably small (say under 100K) try reading it from PL/SQL using UTL_FILE. Otherwise use SQL*Loader, which is very fast but does involve you in shell scripts and control files. I...
Summary: Hey everybody.. I am wondering what software should I download for my PC at home to write and compile Unix Shell Script? Please reply as soon as possible.. Cheers ...
Summary: Hi Guys, I have a unix shell script which is like this... sqlplus -s $FEB_UID/$FEB_PWD@feb_dev |& print -p "select '|'||job_id||'|' from jobreq where status = 'PENDING';" print -p "exit...