Hi Kevin:
I like the idea of using the cursor for a loop but I did not want to make
too many changes to the original code. As written however I do not think
your
code will work. For one thing we need to update pub17.pub_sysdate and not
pub14.mdate.

Paul Bennett

>>> ktoepke_at_rlcarriers.com 01/26/04 03:08PM >>>
Why not use a cursor for loop? Makes the code easy to read as well as
reduces errors (such as having the fetch in the wrong place!)

THEN COMMIT;
END IF;
END LOOP;
COMMIT;
CLOSE pub14_cur;
DBMS_OUTPUT.PUT_LINE (v_insert||' records were
inserted.');

END;
Paul Bennett

>>> jonathan_at_jlcomp.demon.co.uk 01/26/04 02:41PM >>>

That will work, given Wolfgang's assumption
about uniqueness. But as it stands, Oracle will
have to execute two subqueries for every row
in the 18,000,000 row table (I'm not sure that
any of the optimizer versions is currently smart
enough to convert his query into a hash join
with subquery update - but don't take my word
for that, I haven't tested it).

The pl/sql loop will make a maximum of 500,000
probes into the 18,000,000 row table to update.

(I think we are also both assuming that all three
of the join columns are not null, but the pl/sql
may behave contrary to the OP's expectations
if that were the case).