Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is BEGIN COMPOUND equivalent to BEGIN TRANSACTION?

Status
Not open for further replies.

vmmdesai

Programmer
Aug 7, 2002
4
IN
consider the following piece of SQL Server stored procedure

CREATE PROCEDURE DummyProc
( @v1 int,
@v2 int
)
AS
BEGIN
insert into dummytab values (1,1)
BEGIN transaction
insert into dummytab values (2,2)
insert into dummytab values (@v1,@v2)
insert into dummytab values (4,4)
commit transaction
insert into dummytab values (5,5)
END
GO

Can this be mapped to the DB2 code given below?

CREATE PROCEDURE DB2ADMIN.DummyProc (v1 int,v2 int)
LANGUAGE SQL
P1: BEGIN
insert into dummytab values (1,1);
begin compound:
insert into dummytab values (2,2);
insert into dummytab values (v1,v2);
insert into dummytab values (4,4);
end;
insert into dummytab values (5,5);
END P1

Specifically i would like to know, if BEGIN TRANSACTION block in a SQL
server script can be replaced with BEGIN COMPOUND clause in DB2 as shown
above?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top