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 primary index in teradata?

798


How to run a query in teradata?

786


What are default access rights in teradata? What explicit right can be given to a user?

854


Why teradata is used?

765


what is object level locking ? where do appear this type of locking ?

3288


What are the uses of bynets in multi-node systems?

769


What is bteq script in teradata?

814


What is difference between user and database in teradata?

831


Mention a few of the ETL tools that come under Teradata.

832


List the logical and conditional operators that are used with teradata along with their meanings?

739


Comment whether bottleneck is an error or not.

818


Backup Script was blocked then you are unable to archive the data. how do you analyze it and where do you identify ?

1704


Can any one explain me the difference between BTEQ and MLOAD,TUMP. All canbe used for same purpose but still differnt methods. why ?

3265


How to write the query . eid enm doj dob i want to display the names who worked more than 25 years .

1526


How would you load a very large file in teradata in general? What utility would you use for it? Why?

838