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
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 |
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 |
what are the file sizes in your project?
We are migrating an oracle table into teradata, the volume of data is huge and partitioned (year wise list partition). How do i simulate the same in teradata.
in teradata level primary in table level allows duplicates why?
What are default access rights in teradata?
If I wanted to run a TPump job only once per day - basically working on a file that is produced once per day - how would you set up the parameters for that sort of job ?
If the query is NOT WRITTEN PROPERLY then what are the recommendations you can give to the developer ?
What is a pseudo key? What is its use???
What is stored procedure in teradata?
i have column like below studentid studentname sub1 sub2 sub3 1 aaa 40 70 90 2 bbb 60 80 50 i want to execute every student highest mark in which subject my o/p like below studentid studentname sub3 sub2 1 aaa 90 2 bbb 80
any one answer me how they can analyzing the project using data ware housing?
What is collect State in Teradata ? what it use and how it works??
What is primary index and secondary index?