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: Ted Knijff <knijff_at_bigfoot.com>
Date: Fri, 09 Mar 2001 06:48:48 GMT
Message-ID: <3aa87c04.408537@news.online.de>

Perhaps I don't quite get it, but I suppose you want to :

INSERT INTO Table1 (BidNo) VALUES (SEQ_BidNo.NEXTVAL); INSERT INTO Table2 (BidNo) VALUES (SEQ_BidNo.CURRVAL);

Hth

On Mon, 05 Mar 2001 12:58:38 GMT, Steve Bell <swayne.bell_at_sympatico.ca> wrote:

>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
>>
>>
>>
>>
>

EMail: knijff_at_bigfoot.com Received on Fri Mar 09 2001 - 00:48:48 CST

Original text of this message

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