![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| capture ftp return code..PLZ HELP | anju | Shell Programming and Scripting | 3 | 04-03-2008 10:08 AM |
| how to capture the return value in master script? | mahek_bedi | UNIX for Dummies Questions & Answers | 2 | 08-12-2007 06:43 AM |
| how to return an array of elements from oracle to shell script | satyakiran | Shell Programming and Scripting | 3 | 08-02-2005 09:57 AM |
| Store return code of shell script in oracle table | sveera | Shell Programming and Scripting | 3 | 05-04-2005 01:25 PM |
| return code from oracle | lesstjm | Shell Programming and Scripting | 3 | 01-29-2002 03:50 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Capture Oracle return code in shell script
I am using the following code in my shell script
list=`sqlplus -s $user/$pwd@$dbms<<EOF WHENEVER SQLERROR EXIT SQL.SQLCODE set pagesize 0 feedback off verify off heading off echo off select * from control_tbl where src_nm=$3 and extrct_nm=$4; exit SQL.SQLCODE; EOF` ERROR=$? if [ ${ERROR} -ne 0 ] then echo "Failure" >> $LOGFILE else echo "Success" >> $LOGFILE fi Problem I am facing is, it does not log a 'success' or 'failure'. It simply skips the above if loop, even though the list variable contains resultset from oracle table. Can anybody help me understand what exactly the problem is and how I can fix it? Appreciate all the help, folks Thanks Vikas. |
|
||||
|
Try this
list=`sqlplus -s $user/$pwd@$dbms<<EOF
WHENEVER SQLERROR EXIT FAILURE set pagesize 0 feedback off verify off heading off echo off select * from control_tbl where src_nm=$3 and extrct_nm=$4; EOF` ERROR=$? if [ ${ERROR} -ne 0 ] then echo "Failure" >> $LOGFILE else echo "Success" >> $LOGFILE fi |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|