Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Help With Exception Handling - forum topic by acire818

$
0
0

I am new to teradata.  I have created a Stored Procedure that pulls SQL statments from a table, execute those statementes and places the results in another table.  If any of those SQl statements fail I want the error to be stored in our Log table.  I placed a SQL statement that I know will fail but when I run the procedure I see the Procedure call fais and it give me the error messsage but it is not inserting into the log table. Below is the exception code I am using. Any help is appreciated.
BEGIN
DECLAREEXITHANDLERFOR SQLEXCEPTION
                BEGIN
                SET V_SQL_Msg = V_SQL_ERR_CD || '    ' || V_SQL_STATE;
 INSERTINTO EMAR_DEV.M_SIT_LOG_TB
 VALUES(PV_USER_NAME, 'M_CLM_SIT_TESTING_TB',PV_TEST_SUITE, 'ALL',to_char(DATE, 'dd-MON-yyyy'), :v_SQL_Msg, :V_SRC_FINAL_SQL, :V_TRG_FINAL_SQL );
END;
 
END;

Forums: 

Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>