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 -> Re: NextVal quirk

Re: NextVal quirk

From: Pablo Picasso <Pablo.picasso_at_cyberdude.com>
Date: Mon, 21 Sep 1998 10:10:56 GMT
Message-ID: <3606255f.524356644@news.newsguy.com>


You should use a before insert trigger to set your field value.

To get the sequence-Value you can use a statement as follows:

select FIELDID.nextval from dual;

bye,

On Fri, 18 Sep 1998 14:22:52 -0500, "Patrick Janidlo" <janidlo_at_visionarysoftware.spamthis.com> wrote:

>On WindowsNT 4.0 Server service pack 3, Oracle 8.0.4.0.0,
>using the SQL*Plus tool 8.0.4.0.0
>
>I have a sequence (FieldID) defined as incrementing by 1.
>
>When I insert for example:
>
>insert into tablex
> (field_id, field_name)
> values
> (fieldID.NextVal,'test');
>
>where FieldID is a sequence, the nextval command increments the value by
>two, thus the first number is 2, the next is 4, etc.
>
>If I use the CurrVal, I get the error:
>
>ERROR at line 1:
>ORA-08002: sequence FIELDID.CURRVAL is not yet defined in this session
>
>the statement
>
>select * from user_sequences where sequence_name = 'TABLEX';
>
>SEQUENCE_NAME MIN_VALUE MAX_VALUE INCREMENT_BY C O
>CACHE_SIZE LAST_NUMBER
>------------------------------ --------- --------- ------------ - - --------
>-- -----------
>TABLEX 1 1.000E+27 1 N N
>20 21
>
>Any help is welcomed.
>
>
>
>
>
Received on Mon Sep 21 1998 - 05:10:56 CDT

Original text of this message

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