Hi all,
I am trying to do a simple update using cursors - I get a successful response but the update itself seems to be failing and I am clueless as to whats going wrong. I am including my script below and would appreciate if some one can point me in the right direction.
declare
cursor c1 is select phone_number
from table1 g, table2 c
where g.PHN_SAK = c.PHN_SAK
for update;
myPhn table2.phone_number%type;
begin
open c1;
loop
fetch c1 into myPhn;
exit when c1%notfound;
if length(myPhn) = 8
then
dbms_output.put_line ('AA' || myPhn);
update table2
set phone_number = 'AA' + myPhn
where current of c1;
elsif length(myPhn) = 7
then
dbms_output.put_line ('AAA' || myPhn);
update table2
set phone_number = 'AAA' + myPhn
where current of c1;
end if;
end loop;
close c1;
end;
On execution, I get a "PL/SQL procedure successfully completed." but when I query the table I am trying to update I don't see the desired output. (yes I did commit the changes)
Thanks in advance
I am trying to do a simple update using cursors - I get a successful response but the update itself seems to be failing and I am clueless as to whats going wrong. I am including my script below and would appreciate if some one can point me in the right direction.
declare
cursor c1 is select phone_number
from table1 g, table2 c
where g.PHN_SAK = c.PHN_SAK
for update;
myPhn table2.phone_number%type;
begin
open c1;
loop
fetch c1 into myPhn;
exit when c1%notfound;
if length(myPhn) = 8
then
dbms_output.put_line ('AA' || myPhn);
update table2
set phone_number = 'AA' + myPhn
where current of c1;
elsif length(myPhn) = 7
then
dbms_output.put_line ('AAA' || myPhn);
update table2
set phone_number = 'AAA' + myPhn
where current of c1;
end if;
end loop;
close c1;
end;
On execution, I get a "PL/SQL procedure successfully completed." but when I query the table I am trying to update I don't see the desired output. (yes I did commit the changes)
Thanks in advance