update does not work.. [message #19533] |
Tue, 26 March 2002 00:12 |
ksr
Messages: 112 Registered: January 2002
|
Senior Member |
|
|
Hi,
the update does not work,if i print the update statements through debug output,and then if i execute the update statements individually,it works.
But the actual update statement does not update.
Also,is it possible to issue execute immediate in a loop.
declare
cursor c1 is select distinct dsnmline from timp_schedule ;
sql1 varchar2(2000);
begin
FOR c1_rec IN c1 LOOP
--dbms_output.put_line(c1_rec.fiairline);
--sql1:= 'update timp_schedule set filine = (select idline from tkeyline where dsnmline = ''' || c1_rec.dsnmline ||''') where dsnmline = '''|| c1_rec.dsnmline ||''';' ;
update timp_schedule set filine = (select idline from tkeyline where dsnmline = c1_rec.dsnmline ) where dsnmline like c1_rec.dsnmline ;
dbms_output.put_line(sql1);
END LOOP;
END;
|
|
|
Re: update does not work.. [message #19538 is a reply to message #19533] |
Tue, 26 March 2002 09:00 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
Why do this in a loop or using dynamic SQL at all when you can do it in one statement?
update timp_schedule s
set filine = (select idline
from tkeyline t
where t.dsnmline = s.dsnmline);
|
|
|
Re: update does not work.. [message #19587 is a reply to message #19533] |
Fri, 29 March 2002 15:41 |
Sudhakar Atmakuru
Messages: 58 Registered: May 2001
|
Member |
|
|
If still not happy with Todd's solution, try with
FOR UPDATE OF filine
in the cursor decleartion.
It would just look like
declare cursor c1 is select distinct dsnmline from timp_schedule for update of filine;
Good luck :)
|
|
|