shell - unix script to exit from oracle error when using a wait statement -


i have ksh shell script runs .sql script background , wait statement. possible me capture generic "ora-0" error , exit out completely?

so far:

$oracle_base/bin/sqlplus 2.sql & pid2=$! echo "waiting pid:$pid2" wait $pid2 #look error here #exit program if oracle error 

sql*plus kind of shell itself, catches errors oracle , continues execution. want @ sql*plus command whenever sqlerror, whenever sqlerror exit allows exit error code.

so, @ beginning of .sql script add :

whenever sqlerror exit sql.sqlcode 

and if there sql error exit relevant error code.

now, in shell script after wait can error reading $?.

something (depending on exact syntax of shell) :

wait $pid2 ret=$? if [ $ret != 0 ]  # if not success     exit $ret     # propagate error code fi 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -