Computing.Net > Forums > Unix > sqlplus from unix shell

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.

sqlplus from unix shell

Reply to Message Icon

Name: nauj
Date: September 15, 2008 at 00:16:49 Pacific
OS: AIX 5.1
CPU/Ram: IBM
Comment:

I want to control the execution of a PL/SQL procedure from a UNIX shell script.
Below, I include the script.
The control variable which should recive the return of the procedure, dosn't work well.
I want to control the return, because I want to make a UNIX script to control the execution of
a load data process with some Oracle procedures.
Any advice will be greatly apreciatted.

---
#!/bin/ksh
echo "Executing procedure pl/sql"
SQLPLUS="sqlplus -s /"
ESQUEMA="esquema1"
echo "\
call ${ESQUEMA}.Z_PROC_PRUEBA();" | $SQLPLUS
echo "Controlling pl/sql execution"
var_err=$?
if [ $var_err -gt 0 ]
then
echo "Error executing pl/sql"
else
echo "pl/sql finished sucessfully"
fi




Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: September 15, 2008 at 07:34:22 Pacific
Reply:

I'm not an Oracle person so I can not comment on how you are using sqlplus, but I can question how you sample the exit code, $?

call ${ESQUEMA}.Z_PROC_PRUEBA();" | $SQLPLUS
echo "Controlling pl/sql execution"
var_err=$?

The exit code is set immediately after a command is executed. You are looking at the exit code of the echo command and you probably want to check the previous call command.

If I'm interpreting this correctly, you probably want to do this:

call ${ESQUEMA}.Z_PROC_PRUEBA();" | $SQLPLUS
var_err=$?
echo "Controlling pl/sql execution"


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: sqlplus from unix shell

Unix shell script problem... www.computing.net/answers/unix/unix-shell-script-problem/6217.html

FTP File Size Problem from UNIX to www.computing.net/answers/unix/ftp-file-size-problem-from-unix-to/4240.html

Ftp from Unix Server to Local machi www.computing.net/answers/unix/ftp-from-unix-server-to-local-machi/5245.html