Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: INSERT nextval and UNION SELECT result?
Phil R Lawrence a écrit :
> "Phil R Lawrence" <prlawrence_at_lehigh.edu> wrote in message
> news:85o08c$nb8_at_fidoii.CC.Lehigh.EDU...
> > I want to insert the nextval along with the results of a SELECT into a
> > table. Can't seem to get the syntax right. Oracle books don't cover this
> > one in the examples. I've tried:
> ...
> > INSERT into table
> > (
> > dupcheckid,
> > ...
> > )
> > select
> > dupcheckid.<*>nextval,
> > field1,
> > ...
>
>
>
Just try this :
INSERT into table
( dupcheckid, ... )
select
dupcheckid.nextval, field1, ... from (select one_field field1, ... from ... union select one_other field1, .... from ...);
If you Oracle 7 or more, I think it would work (I don't try).
Pierre Received on Mon Jan 17 2000 - 05:43:42 CST