in a BTEQ we have 2 insert 2 del 2 update statment.
when the BTEQ is restarted i need to run the BTEQ from
after DEL statment(means no need to run the insert & del
stat).what is the logic for the above requirement?

Answer Posted / yuvaevergreen

Adding to above,assuming usage of a simple restart table,
below logic can be used. Below sql will not take care of
insert or delete statement failure. If the update statement
fails, the script would be restarted from update statement.
If the insert or delete statements fail, the script
would be started from insert statement.



bteq << EOF

.logon tdpid/user,password;

SELECT * FROM RESTART_TABLE WHERE STATUS='RESTART';
IF .ACTIVITYCOUNT=1 THEN .GOTO UPDTDML;
IF .ACTIVITYCOUNT=0 THEN .GOTO INSDML;

.label INSDML;
INSERT STATEMENT;

.IF ERRORCODE <> 0 THEN .EXIT;

.label DELDML;
DELETE STATEMENT;

.IF ERRORCODE <> 0 THEN .EXIT;

.LABEL UPDTDML;
UPDATE STATEMENT;

.IF ERRORCODE <> 0 THEN .GO TO REST;

.IF ERRORCODE = 0 THEN .GO TO REST1;

.LABEL REST;
DEL FROM RESTART_TABLE;
INSERT INTO RESTART_TABLE ('RESTART');
.EXIT;

.LABEL REST1;
DEL FROM RESTART_TABLE;
.EXIT;

.EOF

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between global temporary tables and volatile temporary tables?

637


why use references rather than pointers in the public api, particularly for arguments which are modified?

556


What are the commands to make a new table, change a table and remove a table in teradata?

613


What is the use of fallback?

560


Which is more efficient group by or distinct to find duplicates?

646






What do you mean by fastexport in teradata?

561


Explain BYNET.

608


Explain the term 'tables' related to relational database management system?

596


Highlight a few of the advantages that ETL tools have over Teradata.

611


Explain parsing engine in teradata?

593


Describe the between keyword in teradata?

612


Differentiate database data and data warehouse data?

588


What is the use of virtual processor connectivity in teradata?

569


Syntax for case when statement?

610


How many tables can you join in v2r5?

626