![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pass variable from awk to shell script | user_prady | Shell Programming and Scripting | 3 | 04-17-2008 05:43 AM |
| Is it possible to pass variable from awk to shell back | unishiva | Shell Programming and Scripting | 12 | 03-03-2008 01:44 PM |
| How to pass Shell script variable to awk | HIMANI | UNIX for Dummies Questions & Answers | 3 | 07-16-2007 12:23 AM |
| how to pass values from oracle sql plus to unix shell script | trichyselva | UNIX for Dummies Questions & Answers | 2 | 02-24-2006 10:19 AM |
| How to Pass variable to shell Script | sam70 | UNIX for Dummies Questions & Answers | 5 | 08-23-2005 07:27 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to pass a oracle variable back to the shell script
Hi,
I am calling an oracle function that returns a number (either 0 or 2), how do I pass that pass to the wrapping shell script as I would like to do other things based on the value returned by the oracle function. Your help will be appreciated. -------------------------- sqlplus / << ENDPROG declare return_code integer; begin return_code := kf_pkg_load.df_validate_file('SAS','20050612',null,null,null,null,null,null,null,null); commit; end; / exit; ENDPROG --------------------------- |
|
||||
|
Quote:
return code. Code:
result=sqlplus / << ENDPROG
declare
return_code integer;
begin
return_code := kf_pkg_load.df_validate_file('SAS','20050612',null,null,null,null,null,null,null,null);
commit;
end;
/
Code:
part_info=`sqlplus -s ${DB_USER:}/${DB_PASSWORD:}@${ORACLE_SID} <<_EOF_
set feedback off
set linesize 100
whenever sqlerror exit failure;
set lines 150
set pages 0
set head off
set serveroutput on size 10000
kf_pkg_load.df_validate_file
'SAS','20050612',null,null,null,null,null,null,null,null);
exit;
_EOF_`
Hope this helps ![]() |
|
||||
|
Thanks VIGSGB for responding, I tried to run this (I had to make some changes to make it run):
---------------------------------- part_info=`sqlplus sars2d/oracle@kfdmlc <<_EOF_ set serveroutput on size 10000 declare abc integer; begin abc:= kf_pkg_load.df_validate_file( 'SAS','20050612',null,null,null,null,null,null,null,null); dbms_output.put_line('return code is:'||abc) ; end; / exit; _EOF_` ------------------------------ However, when I do an echo on part_info, it returns this: ------------------------------------ SQL*Plus: Release 9.2.0.1.0 - Production on Mon Jul 11 12:50:24 2005 Copyright ( c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i E nterprise Edition Release 9.2.0.1.0 - 64bit Production With the Partitioning opt ion JServer Release 9.2.0.1.0 - Production SQL> SQL> 2 3 4 5 6 7 8 start date is : current load instance id is : last load instance id is : 122 return code is:0 PL/SQL procedure successfully completed. SQL> Disconnected from Oracle9i Enterpr ise Edition Release 9.2.0.1.0 - 64bit Production With the Partitioning option JS erver Release 9.2.0.1.0 - Production ----------------------------------- What am I doing wrong? Thanks in advance. JTrinh |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|