Solved

Set isolation level in db2 luw stored procedure

Posted on 2011-03-24
2
1,351 Views
Last Modified: 2012-05-11
Hi,

I'm new to DB2 and we're just starting to convert our sql stored procedures to db2 luw using the ibm data studio.

I just want to make sure i have the "set current isolation ur" satement in the correct place.

I can't seem to put the statement above the variable declaration. Would you know why this is?

Also, with the isolation statement placed here, is the whole stored procedure set to use read uncommitted?

The test stored procedure is below.

Thanks.
CREATE PROCEDURE TEMP_PROC1 (IN NAMEA VARCHAR(125))
DYNAMIC RESULT SETS 1
P1: BEGIN

DECLARE currentDEPT varchar(10);
SET currentDEPT = 'Test';

SET CURRENT ISOLATION UR;

DECLARE GLOBAL TEMPORARY TABLE SESSION.TEMP_TABLE
(COL1   VARCHAR(125)
) ON COMMIT PRESERVE ROWS NOT LOGGED WITH REPLACE;

INSERT INTO SESSION.TEMP_TABLE
SELECT NAME
FROM SYSIBM.SYSTABLES
WHERE CREATOR = NAMEA;

COMMIT;

BEGIN
DECLARE c2 CURSOR WITH RETURN FOR


SELECT COL1, currentDEPT
FROM SESSION.TEMP_TABLE;

OPEN c2;
END;
END P1

Open in new window

0
Comment
Question by:smythsit
2 Comments
 
LVL 37

Accepted Solution

by:
momi_sabag earned 500 total points
ID: 35205922
Hi

just that you would know, insert statement can't run with isolation UR, so db2 will use some other isolation for that statement, besides that, i would put that statement again after the commit, just in case it reset it
0
 

Author Comment

by:smythsit
ID: 35208310
Great thanks a lot.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question