Cursor and updating same records inside cursor rate project radiometric dating

posted by | Leave a comment

By commenting, you are accepting the DISQUS terms of service. Asked: October 19, 2000 - pm UTC Answered by: Tom Kyte - Last updated: May 09, 2011 - am UTC Category: Database - Version: v 8.1.6 Viewed 10K times!

It also does this to ensure that when the time comes, the delete will proceed in a non-blocking fashion. If we first do a Select for Update, we might have another record coming in when we group by subsequently. Regards, ed Wrote file 1 declare 2 cursor c is 3 select * from equipment_category_lookup for update nowait ; 4 i number; 5 begin 6 for c1 in c loop 7 update equipment_category_lookup 8 set equipment_category_lookup_seq = main_seq.nextval 9 where current of c; 10 end loop; 11* end; SQL / where current of c; * ERROR at line 9: ORA-06550: line 9, column 18: PLS-00404: cursor 'C' must be declared with FOR UPDATE to use with CURRENT OF ORA-06550: line 7, column 1: PL/SQL: SQL Statement ignored SQL ed Wrote file 1 declare 2 cursor c is 3 select * from equipment_category_lookup for update ; 4 i number; 5 begin 6 for c1 in c loop 7 update equipment_category_lookup 8 set equipment_category_lookup_seq = main_seq.nextval 9 where current of c; 10 end loop; 11* end; SQL declare 2 cursor c is 3 select * from emp for update of sal nowait ; 4 i number; 5 begin 6 for c1 in c loop 7 update emp 8 set sal = main_seq.nextval 9 where current of c; 10 end loop; 11 end; 12 / PL/SQL procedure successfully completed.Won't a simple DELETE also lock the rows thus achieving the same result ?Is it absolutely essential to use SELECT FOR UPDATE for doing updates in an environment where the same data can be updated by multiple people ?Do we care if someone tries to update them at the same time ?Also, if the result that was to be achieved with a combination of SELECT FOR UPDATE and DELETE CURRENT OF statement could be done in a single delete statement (with a sub-query) can it be error-prone in a multi-user env ?

Leave a Reply

accommodating people hidden disabilities