oracle get many out params from procedures

Hi,

Reference to post: http://www.experts-exchange.com/Database/Oracle/Q_28605273.html
Solution id:ID: 40575654

If i have 2 out parameters ,how can i get them both in my shell variables.

Thanks
LVL 5
magentoAsked:
Who is Participating?
 
Alexander Eßer [Alex140181]Software DeveloperCommented:
Here's my little test setup for your issue:
[oracle@ora12c ~]$ cat proc_out_test.sh
Result=`sqlplus -s user/password <<EOSQL
alter session set container = pdborcl1;
var var1 number;
var var2 number;
exec myproc(:var1, :var2);
print :var1
print :var2
exit
EOSQL`
echo $Result
[oracle@ora12c ~]$ ./proc_out_test.sh 
Session altered. PL/SQL procedure successfully completed. VAR1 ---------- 1 VAR2 ---------- 2
[oracle@ora12c ~]$ 

Open in new window


I suppose you're NOT using 12c yet, so leave out the "alter session set container = pdborcl1;" and adjust your login...
0
 
Alexander Eßer [Alex140181]Software DeveloperCommented:
Did you try?!

Result=`sqlplus -s userid/passwd <<EOSQL
var var1 number;
exec myProc( :var1 out number, :var2 out number);
print :var1
print :var2
exit
EOSQL`

Open in new window

0
 
magentoAuthor Commented:
So both the out parameters will be stored in variable $Result?
0
 
magentoAuthor Commented:
Its works fine for me . Thanks for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.