how do i create an updatable cursor [message #36163] |
Thu, 08 November 2001 06:03 |
Srinivas
Messages: 138 Registered: June 2000
|
Senior Member |
|
|
Hi,
I have a cursor and i am looping it,
for every loop,i want to update that cursor( the current record).
how do i create a updatable cursor and how do i use it.
Any help is appreciated.
Srinivas
----------------------------------------------------------------------
|
|
|
Re: how do i create an updatable cursor [message #36167 is a reply to message #36163] |
Thu, 08 November 2001 07:40 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
Option 1 (pre-lock all the rows):
for r in (select * from t for update) loop
update t
set c = 'something'
where current of r;
end loop;
Option 2 (no pre-locking):
for r in (select t.*, rowid from t) loop
update t
set c = 'something'
where rowid = r.rowid;
end loop;
----------------------------------------------------------------------
|
|
|
|