Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 27 Jul 2006 @ 13:38:43 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Error Trapping for BTEQ Scripts
 
From:   Ferry, Craig

I would like to get some ideas on error trapping for bteq ksh scripts.

I have my script coded as follows:

     .QUIT;
     EOF

     ERROR=$?
     if [ $ERROR -ne 0 ]
     then
      echo "DLY SALES TEMP BUILD FAILED"
      echo "ERROR is " $ERROR
      email_status DLY_SALES
      exit $ERROR
     fi

Obviously it aborts the script if I receive an error in the bteq portion of my script directly above the .QUIT command. Most of the time this is exactly what I want to happen.

I ran into a problem last night (shown in the log below) where we had a system panic, a rollback was initiated, and the SQL was resubmitted.

Once it was resubmitted, it ran successfully. But the RC level was still 8 because of the rollback. Capturing errors the way I do, the script aborted and I had to resubmit the parts of the script below the exit.

I would like to be able to do something that ignores errors if the statement was resubmitted another time and worked fine the next time. I know I can set the severity level for certain errors (like 2828 in this example), but want to know if this statement would have failed a second time, would it have generateda different error?


Thanks in advance for any ideas.

Craig


     INSERT INTO dss_tables.dly_sales_TEMP
     SELECT *
     FROM dss_tables.dly_sales_tbl;
      *** Failure 2828 Request was rolled back during system recovery.
                     Statement# 1, Info =0
      *** Total elapsed time was 20 minutes and 2 seconds.


      *** Warning: Attempting to resubmit last request.

      *** Insert completed. 140573588 rows added.
      *** Total elapsed time was 24 minutes and 10 seconds.

     .QUIT;

      *** You are now logged off from the DBC.
      *** Exiting BTEQ...
      *** RC (return code) = 8
     DLY SALES TEMP BUILD FAILED
     ERROR is  8

Craig Ferry
Manager, Data Warehousing and Central Systems
WESCO Distribution, Inc.



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023