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

Home -> Community -> Usenet -> c.d.o.server -> Re: Returning value from PL/SQL to UNIX shell

Re: Returning value from PL/SQL to UNIX shell

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 30 Sep 1999 21:15:25 GMT
Message-ID: <7t0jtd$d6c$1@relay1.dsccc.com>


for pass/fail type codes

SQL> variable x number;
SQL> column rtn_code new_value _rtn_code
SQL> begin
   2     :x := 5;
   3  end;      

   4 /   

 PL/SQL procedure successfully completed.   

 SQL> select :x rtn_code from dual;   

     rtn_code


          5   

 SQL> exit _rtn_code;

echo $?

Now, run the test for 128, 513, 1000 and see what the korn shell displays for the status return code.

For anything else, I would spool the return code to a file and use set to test the result.

set pagesize 0
set feedback off
variable x number;
begin
  :x := 5;
end;
/
spool rtn_code
select :x from dual;
spool off
exit

#!/bin/ksh
sqlplus scott/tiger @above.sql
set `cat rtn_code.lst`
if [ $1 = 'some-value" ] ;then
  whatever ;
fi ;

la_quake_at_my-deja.com wrote:
: Hello All,

: We submit a shell script job that calls a PL/SQL function. I need a
: return code back to the UNIX shell script. How can I do this? All
: ideas are greatly appreciated.

: --
: Please visit the following site to get to know the real Sathya Sai Baba:
: http://www.myfreeoffice.com/saibabaexposed/index.html

: Sent via Deja.com http://www.deja.com/
: Before you buy.

--
While Alcatel may claim ownership of all my ideas (on or off the job), Alcatel does not claim any responsibility for them. Warranty expired when u opened this article and I will not be responsible for its contents or use. Received on Thu Sep 30 1999 - 16:15:25 CDT

Original text of this message

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