View previous topic :: View next topic
|
Author |
Message |
krish_mrt
New User
Joined: 15 Apr 2005 Posts: 12 Location: Chennai
|
|
|
|
Code: |
UPDATE TAB1
SET COL1 = (SELECT TAB2.COL1
FROM TAB2
WHERE TAB2.COL2 = 'XX'); |
In the code above, I would like to know the kind of locks applied on the tables TAB1 and TAB2.
And... I would also like to know what would be the effect on the update statement on specifying the clause- "WITH UR"
in the update statement as ...
Code: |
UPDATE TAB1
SET COL1 = ( SELECT TAB2.COL1
FROM TAB2
WHERE TAB2.COL2 = 'XX')
WITH UR; |
|
|
Back to top |
|
|
Gurmeet
New User
Joined: 22 Feb 2006 Posts: 46 Location: Pune
|
|
|
|
[quote=
And... I would also like to know what would be the effect on the update statement on specifying the clause- "WITH UR"
in the update statement as ...
Code: |
UPDATE TAB1
SET COL1 = ( SELECT TAB2.COL1
FROM TAB2
WHERE TAB2.COL2 = 'XX')
WITH UR; |
[/quote]
WITH UR is not allowed with a update clause... |
|
Back to top |
|
|
die7nadal
Active User
Joined: 23 Mar 2005 Posts: 156
|
|
|
|
I am answering this from the top of my head. Generally locks are defined when they define a Table space.
So for your first question, it depends upon the TS the Tables are present in.
For the 2nd question, Gurmeet is right, u will get an SQL Code, u cannot update a table with UR. |
|
Back to top |
|
|
sumasudesh
New User
Joined: 25 May 2006 Posts: 1 Location: singapore
|
|
|
|
In DB2, I just want to know that how can I apply lock when selecting a SINGLE ROW? (ROW-LEVEL) |
|
Back to top |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
Hi,
i guess u r talking of four lock levels in db2 .
RR - REPEATABLE READ (locks whole db2 object u r accessing )
RS - READ STABILITY ( locks only rows or pages u scanned )
CS - CURSOR STABILITY (locks current row u r accessing )
UR - UNCOMITTED READ
in ur case use 'CS' for row level locking while scanning
i hope this fulfills ur question
Thanks ,
-Kapil . |
|
Back to top |
|
|
|