Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 10 Sep 2002 @ 16:25:12 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: Macro to loop thru different databases
From:   Geoffrey Rommel

Here is my understanding of all this. A transaction can contain one or more requests; a request can contain one or more statements. Take this example:

1    bt;
2    update tablea ...;  /* Request #1 */
3    insert into tableb  /* Request #2 */
4     select * from tablec
5    ;insert into tableb
6     select * from tabled
7    ;
8    et;

When run in BTEQ, this is a single transaction containing (1) a request of one statement and (2) a request of two statements. If we were to remove the 'bt' and 'et' statements, it would then be two implicit transactions; again, the first request would be one statement, and the second would be a single transaction, a single request, but two statements -- i.e. a multi-statement request.

The reason this works is that BTEQ allows you to enter multiple statements in a single request by starting a new statement immediately after a semicolon, as on line 5. It takes the statements from lines 4-7 and puts them in a single CLI parcel -- one request, many statements.

If, however, lines 2-7 were put into a macro, they would now constitute one transaction with *three* requests, each consisting of a single statement. None would be a multi-statement request. Why? Because macros do not use the BTEQ convention of combining multiple statements into a single request. In fact, I believe they have no convention of their own, so each SQL statement in a macro will always be a single-statement request.

If I am mistaken, I'm sure we'll hear about it!


  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023