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?

Answers were Sorted based on User's Feedback



in a BTEQ we have 2 insert 2 del 2 update statment. when the BTEQ is restarted i need to run the BT..

Answer / 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

in a BTEQ we have 2 insert 2 del 2 update statment. when the BTEQ is restarted i need to run the BT..

Answer / aarsh dave

Create an empty file before each set of DML statements.
Write the BTEQ as below:

bteq << EOF

.logon tdpid/user,password;

.OS if [-f bteq_restart.txt];then else {touch bteq_restart.txt};

.run file bteq_restart.txt;

.label INSDML;

INSERT STATEMENT 1;

INSERT STATEMENT 2;

.IF ERRORCODE <> 0 THEN .EXIT ERRORCODE;

.label DELDML;

DELETE STATEMENT 1;

DELETE STATEMENT 2;

.IF ERRORCODE <> 0 THEN .EXIT ERRORCODE;

.IF ERRORCODE <> 0 THEN .OS echo '.GOTO UPDTDML' >
bteq_restart.txt;

.LABEL UPDTDML;

UPDATE STATEMENT 1;

UPDATE STATEMENT 2;

.IF ERRORCODE <> 0 THEN .EXIT ERRORCODE;

.OS rm -f bteq_restart.txt;

.EOF

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More Teradata Interview Questions

what is the difference between start schma and Fsldm?

5 Answers   Intel,


Write a program to show the parser component used in teradata?

0 Answers  


How can you track login parameters of users in teradata?

0 Answers  


why should we go Teradata over Oracle,what is the main differences?

4 Answers   TCS,


Hello all, There is a table with 4 columns in that 3 columns has been already loaded with 5 million records.4th column is empty,Now I have got 5 million records data which has to be loaded into 4th column.How can I load this data fastly in to the 4th column with out using update

5 Answers   CTS, TCS,






Explain BYNET.

0 Answers  


How do you determine the number of sessions?

0 Answers  


What can be achieved by using the teradata rdbms?

0 Answers  


what is identity columns in TD?

2 Answers   Wipro,


What is FILLER command in Teradata?

9 Answers   CTS, IBM,


Aborted in Phase 1 data Acquistion Incomplete in fastload?

2 Answers  


Hi Friends, Please send me Teradata Materials for certifications Thanks in advance !!

0 Answers   HP,


Categories