Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2006
    Posts
    31

    Unanswered: 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?

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •