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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Nextval, Triggers and Inserts

Re: Nextval, Triggers and Inserts

From: Steve Bell <swayne.bell_at_sympatico.ca>
Date: Mon, 05 Mar 2001 12:58:38 GMT
Message-ID: <3AA38AE5.9090006@sympatico.ca>

Hi,
Instead of SELECT...INTO you can just use your sequence.nextval in the VALUES clause of the INSERT statement:

e.g. INSERT INTO TABLE1

         VALUES (sequencename.nextval,....)

I hope this helps,
Steve

april.mcclellan_at_HydroOne.com wrote:

> I have written a function to retrieve the next value (BidNo) from a
> sequence.
> This BidNo should also reside in a table (Table1) which has only one field,
> the BidNo (which is a sequence).
> I pass the value back to an Access database and use it as part of a record
> in another table (Table2).
> When I go to insert the new record into Table2 it fails since the sequence
> value is not in Table1 as I suppose I have just selected it, not inserted
> it.
>
> My function uses this statement : SELECT seq_tblBidGenerator.nextval INTO
> BidNo FROM dual;
>
> How do I retrieve the next value in a sequence AND insert it into a table
> with one field (which should trigger the next sequence) all at the same
> time, ensuring that the value retrieved from nextval is equal to the value
> inserted into Table1?
>
> Probably simple.....
>
> April McClellan
>
>
>
>
  Received on Mon Mar 05 2001 - 06:58:38 CST

Original text of this message

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