Re: How to know in a unix script if oracle procedure executed or failed?

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Wed, 10 Dec 2003 23:09:09 +0100
Message-ID: <3fd7993f$0$24014$626a54ce_at_news.free.fr>


"vishal" <c_vishal_at_hotmail.com> a écrit dans le message de news:24327b26.0312101318.5b1c4f4c_at_posting.google.com...
> Hi,
>
> I am writing my first script to execute a Oracle procedure through a
> unix script. Could you tell me how do I do error handling here? How do
> I know in my script if the procedure executed successfully or failed?
> Thanks
>
> #!/usr/bin/ksh
> sqlplus user/password_at_name <<EOC
> set time on
> set echo on
> select sysdate from dual
> ;
> spool procedureName.log
> exec procedureName
> spool off
> exit
> EOC
(Sorry if double post, there is some problem with my provider.)

You can use the statement "whenever sqlerror exit ..." and test the return code of SQL*Plus. (SQL*Plus User's Guide and Reference, chapter 13: SQL*Plus Command Reference)

Hope this helps
Michel Cadot Received on Wed Dec 10 2003 - 23:09:09 CET

Original text of this message