Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: HELP- Insert/Update Sloooow
hliji_at_yahoo.com wrote:
> Hi,
>
> I have 2 tables, working table W and the history table H.
> W has 2 million rows. I need to compare a common column C
> in both tables. For a record in W, R, if R.C has a value that
> equals to a record's H.C in H, then update that record in H.
> Otherwise, R is considered a new record for H and will be inserted
> into H.
>
> I used a cursor for loop for W. But the operation was extreamly
> slow. Any other solutions?
>
> Thanks in advance.
>
> MK
You have provided insufficient information from which to provide any useful help. What version and compare what to what end?
In any case a cursor loop is almost never the solution to a problem in any currently supported version of Oracle. Look at either straight DML (an update statement) or bulk collection.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Wed Jan 05 2005 - 11:58:40 CST