Macro ...stored procedure

General
Enthusiast

Macro ...stored procedure

Hi,

Can I say that a macro or stored procedure , a transaction? Please explain how.

Thanks and regards,

Raja

2 REPLIES
Enthusiast

Re: Macro ...stored procedure

If you mean that a Macro or Stored Procedure is a transaction, then the Answer is yes. 

First we have to look at what a transaction is? A unit of work, and unit of work may consist of single or multiple SQL statements. 

If you are defining a Macro or a stored procedure you are actually combining multiple statments into a single construct, in Teradata mode this will be handled as a transaction implicitly, but in case of ANSI, you might need Commit at the end to make a Macro or Stored Prco successful transaction.

Khurram
Teradata Employee

Re: Macro ...stored procedure

Raja,

as already mentioned by Khurram, it depends on the transaction mode - Teradata v.s. ANSI.   

In the Teradata mode, the Macro is one transaction.   However, the Stored Procedure is not one transaction - each statement inside SP is a separate transaction (unless explicitly set otherwise).    It is described in documentation:  SQL Stored Procedures and Embedded SQL -> Executing a Stored Procedure -> Initiating a transaction.

Regards,

Vlad.