Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: writing job dependencies shell script
Forgot to mention.
The SQL script to have
whenever sqlerror exit failure rollback - at the beginning
HTH
GovindanK
On Wed, 18 Feb 2004 20:06:37 -0800, "GovindanK" <gkatteri_at_fastmail.fm>
said:
> Here is a sample
>
> reply=1 #Default is successful
> export reply sqlplus username/pw @script ||reply=0 #if Failure Turn Off
> tput smso
> if test $reply -eq 1
> then
> tput rmso
> else
> echo 'There was error while running <script.sql> script'
> echo 'Please Do the needful'
> tput rmso
> exit
> fi
>
>
> HTH
> GovindanK
>
> On Wed, 18 Feb 2004 22:50:41 -0500, "elain he" <elainhe_at_hotmail.com>
> said:
> > Hi,
> > I'm trying to figure out how I can write a shell script that checks the
> > success or failure of DML statements. I have a number of jobs that are
> > dependent on one another. For eg. if JobA fails do not process jobB, and
> > likewise if jobB fails, do not process jobC.
> >
> > Each job looks like the following:
> > jobA:
> > ===
> > #!/bin/ksh
> > sqlplus << eof
> > username/password
> > update tableA set .....
> > eof
> >
> > jobB:
> > ====
> > #!/bin/ksh
> > sqlplus << eof
> > username/password
> > delete tableB .....
> > eof
> >
> > I'm trying to write a simple shell script that does the following checks
> > before executing each job:
> > #!/bin/ksh
> > jobA
> > if [ $? = 0 ];then
> > jobB
> > if [ $? = 0];then
> > jobC
> > if [ $? = 0];then
> > jobD
> > else
> > exit
> > fi
> > else
> > exit
> > fi
> > else
> > exit
> > fi
> >
> > The problem I'm encountering is $? always returns 0 because the sqlplus
> > always completes successfully even though my update or delete statement
> > fails due to rollback seg space or any other issues.
> >
> > Can someone provide me some pointers on how I can write an error handling
> > routine? If there is a better way of writing this, please let me know.
> >
> > thanks.
> >
> > elain
> >
>
-- http://www.fastmail.fm - IMAP accessible web-mail ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Thu Feb 19 2004 - 09:32:46 CST
![]() |
![]() |