Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

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"

![]() |
![]() |
![]() |

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