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: User_Sequence's LAST_NUMBER column: what is it?

Re: User_Sequence's LAST_NUMBER column: what is it?

From: Manuela Mueller <520040906697-0001_at_t-online.de>
Date: Thu, 11 Oct 2001 22:28:46 +0200
Message-ID: <3BC600FE.651E0EDA@t-online.de>


Jerry Liu wrote:
>
> Would someone know what the "LAST_NUMBER" column of the user_sequences
> dictionary table contains? It does not seem to be related to the
> "NEXTVAL" or "CURRVAL" (see below)
> -----------------------------------------------------------------------------
> SQL> ed
> Wrote file afiedt.buf
>
> 1 select SEQUENCE_NAME, min_value, max_value, last_number
> 2* from user_sequences where sequence_name = 'MY_SEQ_20011010'
> SQL> /
>
> SEQUENCE_NAME MIN_VALUE MAX_VALUE LAST_NUMBER
> ------------------------------ ---------- ---------- -----------
> MY_SEQ_20011010 1 1.0000E+27 21
>
> SQL> select MY_SEQ_20011010.nextval, MY_SEQ_20011010.currval from
> dual;
>
> NEXTVAL CURRVAL
> ---------- ----------
> 8 8
> -------------------------------------------------------------------------------
> Thanks,
>
> Jerry

Hello Jerry,
you created your sequence with CACHE option (default option, if you don't like it you have to specify NOCACHE during creation of the sequence). CACHE means Oracle preallocates the numbers and keeps them in memory for faster access. In this case, column LAST_NUMBER dispays the last cached number. Default cache: 20 sequence numbers. For more information, please look at

http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a85397/state25a.htm#2067095

Create yourself a free account on otn if you don't already have one. Regards
Manuela Mueller Received on Thu Oct 11 2001 - 15:28:46 CDT

Original text of this message

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