oracle - PL/SQL "WHERE CURRENT OF" vs "ROWID" -


why oracle made "where current of" syntax when can use "rowid"? example:

begin   rec in (select t.column1, t.rowid rid test_table) loop     update test_table tb set column1 = some_function(rec.column1) tb.rowid = rec.rid;   end loop;   commit; end;  declare    cursor cur select t.column1 test_table;   param1 test_table.column1%type; begin   loop     fetch cur param1;     update test_table tb set tb.column1 = some_function(param1) current of cur;     exit when cur%notfound;   end loop;   commit; end; 

where current of used identify last fetched row in cursor. it's more safe, because have 100% confidence, f.e. updating last fetched row curosr. rowids there's danger, because it's easy mess something.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -