I am in great problem since last 3 days by the following problem.
I have 2 tables as A and B both having 2 fields as name and roll.
I have to update the B table with respect to table A.
Can we do this with the help of query.
I have written a code for this and giving error and system goes
to infinite loop.
The code is following:
Declare
cursor c1 is select * from A where roll IN ( select roll from B);
rec_set emp1%rowtype;
begin
open c1;
fetch c1 into rec_set;
loop
update B set B.name=rec.set.name where B.roll=rec_set.roll;
end loop;
close c1;
end;
When I complied this block, it then goes to infinite and then I
need to stop its services to again login the system.
Looks like in the line
update B set B.name=rec.set.name where B.roll=rec_set.roll;
the underlined part should be rec_set
I think this could be done using a single query also
update B
set B.name = (select name from A T1where T1.roll = B.roll)
be careful the above query will be valid only if the embedded query
returns just one row
Pushker
Quick Links:
Do you have
an Oracle Question?
Best regards,
Oracle Database, SQL,
Application, Programming Tips
All the site contents are Copyright © www.sap-img.com
and the content authors. All rights reserved.
All product names are trademarks of their respective
companies.
The site www.sap-img.com is not affiliated with or endorsed
by any company listed at this site.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
The content on this site may not be reproduced
or redistributed without the express written permission of
www.sap-img.com or the content authors.