Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: writing job dependencies shell script

RE: writing job dependencies shell script

From: <k.sriramkumar_at_iflexsolutions.com>
Date: Thu, 19 Feb 2004 10:04:48 +0530
Message-ID: <10898BE7CA96D611988B000802255AAF0520580E@fmgrt>


Hi elain,

You can add a single line

sqlplus <<eof
username/password
whenever sqlerror exit 1;
-- do your stuff here--

eof

Capture the return of this call. If there was error during the execution = of the sql statement, sqlplus would return 1

Best Regards

Sriram Kumar

-----Original Message-----

From: elain he [mailto:elainhe_at_hotmail.com]=20 Sent: Thursday, February 19, 2004 9:21 AM To: oracle-l_at_freelists.org
Subject: writing job dependencies shell script

Hi,
I'm trying to figure out how I can write a shell script that checks the=20 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:
=3D=3D=3D
#!/bin/ksh
sqlplus << eof
username/password
update tableA set .....
eof

jobB:
=3D=3D=3D=3D
#!/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 [ $? =3D 0 ];then

     jobB
     if [ $? =3D 0];then
          jobC
          if [ $? =3D 0];then
               jobD
          else
               exit
          fi
     else
          exit
     fi
else
     exit

fi

The problem I'm encountering is $? always returns 0 because the sqlplus=20 always completes successfully even though my update or delete statement=20 fails due to rollback seg space or any other issues.

Can someone provide me some pointers on how I can write an error = handling=20
routine? If there is a better way of writing this, please let me know.

thanks.

elain



Watch high-quality video with fast playback at MSN Video. Free!=20 http://click.atdmt.com/AVE/go/onm00200365ave/direct/01/

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

DISCLAIMER:
This message contains privileged and confidential information and is = intended only for the individual named.If you are not the intended = recipient you should not disseminate,distribute,store,print, copy or = deliver this message.Please notify the sender immediately by e-mail if = you have received this e-mail by mistake and delete this e-mail from = your system.E-mail transmission cannot be guaranteed to be secure or = error-free as information could be =
intercepted,corrupted,lost,destroyed,arrive late or incomplete or = contain viruses.The sender therefore does not accept liability for any = errors or omissions in the contents of this message which arise as a = result of e-mail transmission. If verification is required please = request a hard-copy version.

DISCLAIMER:
This message contains privileged and confidential information and is = intended only for the individual named.If you are not the intended = recipient you should not disseminate,distribute,store,print, copy or = deliver this message.Please notify the sender immediately by e-mail if = you have received this e-mail by mistake and delete this e-mail from = your system.E-mail transmission cannot be guaranteed to be secure or = error-free as information could be =
intercepted,corrupted,lost,destroyed,arrive late or incomplete or = contain viruses.The sender therefore does not accept liability for any = errors or omissions in the contents of this message which arise as a = result of e-mail transmission. If verification is required please = request a hard-copy version.



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 Wed Feb 18 2004 - 22:34:48 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US