Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Using FOR UPDATE in PL/SQL
Hello,
First the basics ;)
Oracle version 8.1.7.4
OS Solaris 5.8 on a V880
Then my issue :
I'm writing a package procedure which uses a cursor as part of its job.
That cursor is supposed to lock the rows it acquires so I declare it with
FOR UPDATE
(my code below)
cursor c_for_locking(param1 NUMBER, param2 NUMBER)
RETURN mytable%ROWTYPE
IS SELECT * FROM mytable
WHERE field1=param1 AND field2=param2
FOR UPDATE;
I use it in a LOOP FETCH structure containing an UPDATE statement
UPDATE mytable SET ...
WHERE CURRENT OF c_for_locking;
Everything's just gone fine till this point.
As I don't want Oracle to wait for the rows to be released in case of a
lock,
I would like to set NOWAIT in the FOR UPDATE clause of my cursor
declaration.
I do it ...
I replace my pkg body, Oracle tells me there are some compilation errors
And I get the following
LINE/COL ERROR
-------- ------------------------------------------------------------------- ---------------------------
I RTFM for the action to take to handle this error.
It simply tells me to add FOR UPDATE !
What's the trouble with NOWAIT ?
What did I miss ??
TIA
-- SebReceived on Thu Jan 22 2004 - 03:10:54 CST