Error Code 3807 not working even if .Label

Analytics

Error Code 3807 not working even if .Label

Hi,

bteq <<!

.set session transaction BTET;

.run file=$HOME/.tdlogon

.set errorout stdout;

.set maxerror 2;

.set width 65000;

.set titledashes off;

.set errorlevel on;

DELETE FROM UD466.FF_ACTIVE_INTAKE;

.IF ERRORCODE = 0 THEN .GOTO ACTIVEREC; /*table existed so got errorcode zero*/

.IF ERRORCODE <> 0 THEN .GOTO FINISH;

.IF ERRORCODE=3807 THEN .GOTO NextLBL;

.LABEL NextLBL

CREATE MULTISET TABLE UD466.FF_ACTIVE_INTAKE AS

(SEL * FROM

UD466.FF_INTAKE_REQS

WHERE FINAL_FF_REQUEST_DT >= CURRENT_DATE

AND UPPER(TRIM(FF_EXEC_STATUS)) = 'ACTIVE'

QUALIFY            ROW_NUMBER() OVER (PARTITION BY ERNI_CAMPAIGN_NUMBER, PROMO_CD

ORDER BY LOAD_TIMESTAMP DESC) = 1)

WITH DATA

PRIMARY INDEX (LOB ,ERNI_CAMPAIGN_NUMBER, PROMO_CD);

Problem is when there is no table its just throwing the below error and going to the

DELETE FROM UD466.FF_ACTIVE_INTAKE;

 *** Failure 3807 Object 'UD466.FF_ACTIVE_INTAKE' does not exist.

                Statement# 1, Info =0

 *** Exiting BTEQ...

 *** RC (return code) = 8

Please let me know why this Label thing is not working.

2 REPLIES
Teradata Employee

Re: Error Code 3807 not working even if .Label

  • You set MAXERROR to 2, and the default severity for 3807 is 8; since 8>2, BTEQ exits.
  • Since 3807 <> 0, with this sequence of statements you would go to FINISH if you didn't exit first

An option: override the severity of 3807

.set errorlevel 3807 severity 2;

DELETE FROM UD466.FF_ACTIVE_INTAKE;

.IF ERRORCODE = 0 THEN .GOTO ACTIVEREC;

.IF ERRORCODE=3807 THEN .GOTO NextLBL;

.IF ERRORCODE <> 0 THEN .GOTO FINISH;

.LABEL NextLBL

Re: Error Code 3807 not working even if .Label

Thanks a lot Fred:)