All Forums Tools
anill 26 posts Joined 08/07
09 Nov 2007
BTEQ

Hi friendsI would like to run SQL statements in BTEQ script. In that script I have 3 DML statements. I would like to run one by one.how can I run one by one? Is it possible in BTEQ? Plz give me one example...Thanks and RegardsAnil Reddy

Balamurugan B 81 posts Joined 09/07
16 Nov 2007

Hi Anil,It is possible .To do so you must use Multi-Statement request.There are two types of Teradata SQL request. They are Single-Statement request and Multi-Statement request.Single-statement request will send all the SQL statements as a single request. Single-statement will have semicolon at the end of every statement line, where as Multi-statement will have semicolon at the next line. The following example helps you to understand the above concepts in better way:Eg for Single-statement request: Select * from Table1; Delete from Table2; Select * from Table3;The above three statements will be submitted in a single request.Eg for Multi-statement request: Select * from Table1 ; Delete from Table2 ; Select * from Table3;The above three statements will be submitted in three request.Hope this clears your doubt.Regards,Balamurugan

Regards,
Balamurugan

anill 26 posts Joined 08/07
17 Nov 2007

Thank U, Balamurugan....I got it...Thanks and RegardsAnil Reddy

Fred 1096 posts Joined 08/04
17 Nov 2007

The above explanation is backwards.Single-statement request means each SQL statement is submitted to the DBMS as an independent statement (and processed in sequence). Multi-statement request submits multiple SQL statements to the DBMS at one time, and the DBMS may choose to process them in parallel (if it can be certain there are no dependencies).So single-statement request is the way to guarantee order of execution.

Balamurugan B 81 posts Joined 09/07
18 Nov 2007

As Fred Pluebell said, my previous explanation is backwards…Only single-statement request guarantee the order of execution.

Regards,
Balamurugan

Someshnr 53 posts Joined 06/07
19 Nov 2007

It is always recommended to Label your statements and do an Error Check for the previous statement and then proceed with the following statements.. .IF ERRORCODE = 0 THEN .GOTO Next Label.....

You must sign in to leave a comment.