Passing Parameter from PL/SQL to Unix [message #281277] |
Fri, 16 November 2007 05:42 |
veerendranayak
Messages: 5 Registered: November 2007 Location: Pune
|
Junior Member |
|
|
I am not able to catch the out variable from procedure back to Unix.
Only out variable should be assigned to the Unix variable and not the things printed by DBMS_OUTPUT in procedure.
Can you please help me in this.
Thanx in advance
|
|
|
Re: Passing Parameter from PL/SQL to Unix [message #281286 is a reply to message #281277] |
Fri, 16 November 2007 06:01 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
That's not not easily possible with the shell-script-backtick approach.
There might be a roundabout way to write stuff to spool-files or grepping just specific lines from the output, but I would suggest having a look at using a scripting language with database support, like PERL instead.
Examples
It will make things easier in the long run.
|
|
|
|
|
|
Re: Passing Parameter from PL/SQL to Unix [message #281341 is a reply to message #281337] |
Fri, 16 November 2007 08:05 |
tahpush
Messages: 961 Registered: August 2006 Location: Stockholm/Sweden
|
Senior Member |
|
|
Probably better to do it in pearl, but here is an option
Create a function
SQL> CREATE OR REPLACE FUNCTION get_number112 RETURN INTEGER
2 IS
3 BEGIN
4 return 112;
5 END;
6 /
Funktion skapad
Create Shell script
CONNSTRING=user/pwd@instance
value=`sqlplus -S $CONNSTRING <<END
select get_number112 from dual;
exit;
EOF`
echo "my number is:" $value
Execute Shell script
[/export/home/hpl]. test.sh
my number is: GET_NUMBER112 ------------- 112
[Updated on: Fri, 16 November 2007 08:06] Report message to a moderator
|
|
|
|
|
|
|
Re: Passing Parameter from PL/SQL to Unix [message #281465 is a reply to message #281463] |
Sat, 17 November 2007 01:35 |
|
Michel Cadot
Messages: 68716 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
I give you another way: set termout off during execution containing the dbms_output then turn termout on and display final the result.
Then you will have all in the spool file and only the result in the variable.
Regards
Michel
|
|
|