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

If the PMON is not working then how do you manage and monitor all processes, resources and sessions etc.

0 Answers  


Explain PDE.

0 Answers  


Explain the parallel data extension in teradata?

0 Answers  


I have a table with emp id, emp name, dept id and sal where dept id is NUSI. SEL * FROM EMP WHERE DEPTID = 100. Can any one explain how it will fetch the record.

4 Answers  


which join mostly use in realtime?

2 Answers   TCS,






How will you solve the problem that occurs during update?

0 Answers  


Highlight a few of the important components of Teradata?

0 Answers  


I WANT TO LEARN TERA-DATA ,SO CAN ANY BODY PLZ REFER WHAT ARE THE TOPICS I HAVE TO GO THROUGH, TO GET ASAP JOB ,SO PLZ REFER ME WHERE I CAN GET NICE COACHING ON TERADATA.

13 Answers  


How to Extract data from multiple legacy systems?

0 Answers  


What is the command in bteq to check for session settings ?

0 Answers  


we have two tables emp,dept.emp has eno,ename,sal and dept has deptno,dname.how to find maxsal of each dept wise.which join used for joining.

5 Answers   Accenture, Cognizant,


What is spool space?

0 Answers  


Categories