Thanks for the question, Aman .
Asked: August 28, 2005 - 10:09 am UTC
Last updated: August 28, 2005 - 12:44 pm UTC
Version: 9.2.0.2
Viewed 1000+ times
You Asked
hi sir
what does it mean in the cursors when we use where current of?in the doc it says that it will make it sure that cursor is addressing the currently fetched row,what does it mean?if we dont use this that mean than the row fetched by the cursor and used in the program wont be current?is it?if can give a small demo for it ,will be really very helpful.
on a side note..i was trying to use the advanced search.it said these many results found but there were no results on the page..i dnt know what went wrong..
with best regards
aman
and Tom said...
examples:
</code>
http://asktom.oracle.com/pls/ask/search?p_string=%22where+current+of%22 <code>
(you don't say WHAT you tried to look/search for so I don't know what went wrong either for I have no way to reproduce)
The "where current of" just is syntatic sugar that allows you to update the last row fetched from a cursor -- "update the row currently pointed to by the cursor" is what it means
...
cursor c is select * from emp for update;
begin
open c;
loop
fetch c into record....
exit when c%notfound;
<do something to record>
update emp set .... WHERE CURRENT OF C;
end loop;
close c;
Instead of doing the update by primary key - internally we update the row by ROWID
Is this answer out of date? If it is, please let us know via a Comment