Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> HowTo: Select from insert-table WHILE inserting

HowTo: Select from insert-table WHILE inserting

From: Andreas Koch <mail_at_kochandreas.com>
Date: Wed, 26 Sep 2001 19:13:28 +0200
Message-ID: <9ot2j6$u3s$01$1@news.t-online.com>


Hi,

what is the best way to get something like

insert into tablea (age,name,highestyet) select age,name,(select max(age) from tablea) from tablepersons;

or, for versions below 8i,

insert into tablea (age,name,highestyet) select tp.age,tp.name,tt.maxage
from tablepersons tp, (select max(age) maxage from tablea) tt;

to work correctly.

These two scripts work, but maxage returns the highest age in tablea BEFORE the insert - i need the highest age WHILE the insert.

Any ideas?
The solution has to work without redefining the tables and from an SQL script batch run.

-- 
                                       Andreas
Who doesn't live can never die
Received on Wed Sep 26 2001 - 12:13:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US