All Forums General
Raja_KT 1246 posts Joined 07/09
23 Oct 2013
Macro ...stored procedure

Hi,
 
Can I say that a macro or stored procedure , a transaction? Please explain how.
Thanks and regards,
Raja

Raja K Thaw

My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1

Street Children suffer not by their fault. We can help them if we want.

M.Saeed Khurram 544 posts Joined 09/12
23 Oct 2013

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

VBurmist 96 posts Joined 12/09
23 Oct 2013

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.

You must sign in to leave a comment.