Re: How to trap error in sqlplus?

From: http://www.webyourcompany.com <xzhang88_at_hotmail.com>
Date: 11 Jun 2003 21:30:13 -0700
Message-ID: <2f50b64b.0306112030.5af88320_at_posting.google.com>


create procedure procedure03 as
begin

   procedure01;
   procedure02;
end;
/
$ORACLE_HOME/bin/sqlplus -S $O_USER/$O_PASSWORD << EOF
> set serveroutput on
> set echo off
> set feedback off
> set heading off
> spool $SPOOLFILE
> whenever sqlerror exit;
> EXECUTE procedure03;
> spool off
> exit
> EOF
HTH,
http://www.webyourcompany.com

pmahale_at_yahoo.com (Prasad Mahale) wrote in message news:<44a6df49.0306111309.7c80316a_at_posting.google.com>...
> Hi All,
> I am not an expert in oracle but trying to do something like this -
>
> Here are the lines from the shell script -
>
> ..
> ..
> $ORACLE_HOME/bin/sqlplus -S $O_USER/$O_PASSWORD << EOF
> set serveroutput on
> set echo off
> set feedback off
> set heading off
> spool $SPOOLFILE
> EXECUTE procedure01;
> EXECUTE procedure02;
> spool off
> exit
> EOF
>
> ..
> ..
>
> What happens is, when procedure01 fails, it goes ahead and executes
> procedure02. I want Oracle to exit if procedure01 fails. What is the
> easiest way to do this?
>
> Thanks in advance.
>
> prasad
Received on Thu Jun 12 2003 - 06:30:13 CEST

Original text of this message