Re: How to get a return code from an host command in SQL*Plus ?

From: <marcpark_at_my-deja.com>
Date: 2000/05/03
Message-ID: <8epftt$574$1_at_nnrp1.deja.com>#1/1


[Quoted] Yes, it is possible to get the return code form a host command An example in unix
variable marc number
!ls ajdadfaldjfl; echo select $? into marc from dual > marc_select.sql !echo "/" >> marc_select.sql
_at_marc_select
Which would return 2 into the bind varaible marc.

Then create a pl/sql script.
You look at the bind_variable and determine if to continue or not.
declare

begin
  IF :marc = 0 THEN

     update emp set ...
   END IF
END; This is not trivial and would need more word to ensure it works, but the general concept is there

Marc Parkinson
Oracle Developer

[Quoted] In article <8ep751$2vca$1_at_news4.isdnet.net>,   "Michel Cadot" <micadot_at_netcourrier.com> wrote:
>
> In a SQL*Plus script, i have to launch an host command,
> then test its return code and go on with the SQL script
> only if it is 0.
>
> How to get and test this return code?
>
> Example:
> SQL> select * from emp where ...;
> SQL> host myProg
> SQL> if myProg return code is not 0 exit <-- Can i do this and how?
> SQL> update emp set ...
>
> --
> Thanks
> Michel
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed May 03 2000 - 00:00:00 CEST

Original text of this message