dbTalk Databases Forums  

Getting currval from a sequence with out incrementing nextval

comp.databases.oracle.server comp.databases.oracle.server


Discuss Getting currval from a sequence with out incrementing nextval in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Brian Peasland
 
Posts: n/a

Default Re: Getting currval from a sequence with out incrementing nextval - 05-01-2006 , 01:48 PM






Quote:
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 (DOT) 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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.