Home » Infrastructure » Unix » How do I store the output parameter of an oracle procedure into a unix variable?
How do I store the output parameter of an oracle procedure into a unix variable? [message #97085] Wed, 21 November 2001 00:19 Go to next message
François Istace
Messages: 1
Registered: November 2001
Junior Member
Hi,

I am looking for an easy way to store an output parameter of an oracle procedure into a unix variable.

What is the easiest way to proceed?

Thank you.

François.

----------------------------------------------------------------------
Re: How do I store the output parameter of an oracle procedure into a unix variable? [message #97088 is a reply to message #97085] Fri, 23 November 2001 08:21 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Repalce each '~' with a '<' (posting of double '<' doesnt work).

#!/bin/ksh
RETVAL=`sqlplus -s scott/pass ~~EOF
set serveroutput on
WHENEVER SQLERROR EXIT 1
declare
x number;
begin
x := 999;
dbms_output.put_line('the_result_is '||x);
end;
/
exit;
EOF`

echo $RETVAL
X=`echo $RETVAL | awk '{print $2}'`
echo $X

sqlplus -s scott/pass ~~EOF | read RETVAL
set serveroutput on
WHENEVER SQLERROR EXIT 1
declare
x number;
begin
x := 999;
dbms_output.put_line('the_result_is '||x);
end;
/
exit;
EOF

echo $RETVAL

X=`echo $RETVAL | awk '{print $2}'`
echo $X

----------------------------------------------------------------------
Previous Topic: Re: limit spool file size...
Next Topic: Re: Installing Oracle 8.1.7 on Redhat Linux 7.1
Goto Forum:
  


Current Time: Wed Jan 27 11:18:45 CST 2021