If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > handling oracle error in unix

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-06-06, 07:50
bhaizone bhaizone is offline
Registered User
 
Join Date: Feb 2006
Posts: 31
handling oracle error in unix

my code in unix is like :

out_stat=`${SCRIPTS_DIR_PATH}/hide $ORACLE_BIN/sqlplus -s user/password${string} << EOF >> $LOG_FILE
set serveroutput on
set echo off
set feedback off
set head off
exec TRUNC_TMP_TABLE('$TABLE');
exit
EOF`

sqlplus_code=$out_stat
if [ "$sqlplus_code" -ne "0" ]
then
print "[ $0, $$, $(date "+%m/%d/%Y %H:%M:%S") ] ERROR: Truncation of $TABLE table Failed. Please check the log file $LOG_FILE"
exit 71
else
print "[ $0, $$, $(date "+%m/%d/%Y %H:%M:%S") ] PROGRESS: Truncation process on $TABLE table successful"
fi




Now whether the table exists or not i am always getting message as truncation successfull. how to check this?
Reply With Quote
  #2 (permalink)  
Old 04-06-06, 12:54
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool


It depends if TRUNC_TMP_TABLE procedure returns error or not, try this:
Code:
out_stat=`${SCRIPTS_DIR_PATH}/hide $ORACLE_BIN/sqlplus -s user/password${string} << EOF >> $LOG_FILE
WHENEVER SQLERROR EXIT 99;
set serveroutput on
set echo off
set feedback off
set head off
exec TRUNC_TMP_TABLE('$TABLE');
exit 0
EOF`



__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On