Need help in FOR UPDATE & WHERE CURRENT OF clause

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
ali560045
Forum Newbie
Posts: 3
Joined: Mon Jun 23, 2008 5:14 am

Need help in FOR UPDATE & WHERE CURRENT OF clause

Post by ali560045 »

i have a PL/SQL Block that updates a table f by using the concept of "FOR UPDATE" & "WHERE CURRENT OF" Clause.Below is the code

Code: Select all

 
 
declare
       v_a f.a%type;
       v_b f.b%type;
       cursor cur_r is
       select a,b from f where length(b) = 5 for update;
Begin
       for record in cur_r
       LOOP 
            update f set a=v_a*v_a where current of cur_r;
       End loop;
end;
 
 
Contents of table f

Code: Select all

 
A     B
--   ---
 
5    Five 
6    Six 
7    Seven
8    Eight
9    Nine
 
The above PL/SQL BLOCK is giving me the NULL Value for A=7 and A=8.Please help me
Post Reply