Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: HowTo: Select from insert-table WHILE inserting
On Wed, 26 Sep 2001, mail_at_kochandreas.com wrote:
> These two scripts work, but maxage returns the highest age in
> tablea BEFORE the insert - i need the highest age WHILE
> the insert.
I don't believe this can be done with straight DML. Oracle hides all uncommitted transactions from a transaction that is currently underway, even if the current transaction has produced the rows in question.
You would need to define a PL/SQL script which first got the max(age) from tablea. Then this PL/SQL would need to compare the next age with this to continue to find the max(age) and insert that value in all of the new rows until it happened upon a higher age and continue again ...
-- Galen Boyer Everyone in town, now, they probably all agree, I'm _lying_ in the bed I made.Received on Wed Sep 26 2001 - 21:05:27 CDT