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

Home -> Community -> Usenet -> c.d.o.server -> Re: Getting currval from a sequence with out incrementing nextval

Re: Getting currval from a sequence with out incrementing nextval

From: Brian Peasland <oracle_dba_at_nospam.peasland.net>
Date: Mon, 1 May 2006 18:48:02 GMT
Message-ID: <IyLo88.G6K@igsrsparc2.er.usgs.gov>


> create sequence s;
> select s.nextval from dual;
> select s.currval from dual;
> select last_number FROM ALL_SEQUENCES Where Sequence_name='S';

And just in case the lazy one is too lazy to perform a simple test, I post the results here:

SQL> CREATE SEQUENCE s;

Sequence created.

SQL> SELECT s.NEXTVAL FROM dual;

    NEXTVAL


          1

SQL> SELECT s.CURRVAL FROM dual;

    CURRVAL


          1

SQL> SELECT last_number FROM all_sequences WHERE sequence_name='S';

LAST_NUMBER


          21

Cheers,
Brian

-- 
===================================================================

Brian Peasland
oracle_dba_at_nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Received on Mon May 01 2006 - 13:48:02 CDT

Original text of this message

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