Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sequence.nextval ?
It's either
insert into table2
select dupcheckid.nextval, field1, field2, field3
from table1
(ie: you can mix them, nextval is a pseudocolumn)
or
insert into table2
values
(dupcheckid.nextval, field1, field2, field3)
assuming field1..3 are host variables.
Hth,
--
Sybrand Bakker, Oracle DBA
Phil R Lawrence <prlawrence_at_lehigh.edu> wrote in message
news:85o0uh$ch0_at_fidoii.CC.Lehigh.EDU...
>
> I wrote:
>
> > 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:
>
> The examples should be clearer ths way:
> ____________________
> INSERT into table
> (
> dupcheckid,
> field1,
> ...
> )
> VALUES
> (
> dupcheckid.nextval,
> (
> <*>select
> field1,
> ...
> )
> )
> ____________________
> ORA-00936: missing expression (DBD: error possibly near <*> indicator
>
> and
> ____________________
> INSERT into table
> (
> dupcheckid,
> field1,
> ...
> )
> select
> dupcheckid.<*>nextval,
> field1,
> ...
> ____________________
> ORA-02287: sequence number not allowed here (DBD: error possibly near <*>
> indicator
>
> Thanks for any help,
> Phil R Lawrence
>
>
>
>
>
>
Received on Fri Jan 14 2000 - 15:32:42 CST