Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Please ask technical questions in the appropriate category. Thank you!

Multiple columns and rows update using select staement

617417Mar 25 2009 — edited Mar 26 2009
i am trying to update the 2 colums of a table based on the cursor result set with key values are matching.



DECLARE

CURSOR update_master
IS
SELECT B.cust_num,c.cust_num,
B.cust_name,B.cust_bal
FROM
Table_one B
JOIN
Table_two C
ON B.cust_num= C.cust_num;

BEGIN

FOR master_rec IN update_master

LOOP

UPDATE Table_three
SET col1 = master_rec.cust_name,
Col2 = master_rec.cust_bal,
Where WHERE Cust_num = master.cust_num;

END LOOP;
COMMIT;
END;

The 3 tables are having around 50000 records individually............

It is taking too much of time to execute......more than 6 minutes......

how can we optimize it?? can we write this update statement directly? instead of writing it in procedure?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 23 2009
Added on Mar 25 2009
8 comments
79,250 views