BTEQ

Tools
Enthusiast

BTEQ

Hi friends

I 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 Regards
Anil Reddy
5 REPLIES
Enthusiast

Re: BTEQ

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
Enthusiast

Re: BTEQ

Thank U, Balamurugan....
I got it...

Thanks and Regards
Anil Reddy
Teradata Employee

Re: BTEQ

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.
Enthusiast

Re: BTEQ

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

Re: BTEQ

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.....