Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Getting currval from a sequence with out incrementing nextval
> 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" - UnknownReceived on Mon May 01 2006 - 13:48:02 CDT