[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Set isolation level in db2 luw stored procedure

Posted on 2011-03-24
2
Medium Priority
?
1,434 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 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
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…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

830 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