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: retreiving CurrVal in a select statement.

Re: retreiving CurrVal in a select statement.

From: Frédéric Trébuchet <frederic.trebuchet_at_sncf.fr>
Date: 1997/12/02
Message-ID: <01bcff16$e72a6550$5a02a994@mimp46>#1/1

Hi Kal,

Current value for a sequence is accessible via a "select seq_name.currval from dual" only after a new sequence number have been getted via a "select seq_name.nextval from dual" within the same session (unless you'll have an ORA-08002). If you want to know which number was distributed last time a sequence was used, use something like "select last_number from user_sequences where sequence_name = "SEQ_NAME".

Have a look to user_sequences, dba_sequences and all_sequences views for detailed informations about sequences in your database.

TRF Kal Khatib <kal_at_gene.COM> a écrit dans l'article <34835F93.EE2D03B0_at_gene.com>...
> How do you get the current value of a sequence in a select statement;
> I try;
> select CurrVal from some_sequence
> I get
> ORA-02201: sequence not allowed here
>
> is it possible using the above method? Or is there another way? I'm
> trying to assign transactions a unique sequence, then pass the assigned
> sequence to the customer for their reference in the same sesison.
>
> thanks for any help.
> Kal.
>
>
Received on Tue Dec 02 1997 - 00:00:00 CST

Original text of this message

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