Re: column populated from sequence

From: Stjepan Brbot <Stjepan.Brbot_at_ZG.HiNet.HR>
Date: Tue, 27 Nov 2001 21:43:47 +0100
Message-ID: <9u10fq$4tv5$3_at_as201.hinet.hr>


What does it mean? When I retrieve a number from a sequence, next "n" values are cached (retrieved from sequence) too and LAST_NUMBER of sequnce is increased by n. What if do not use next "n-1" values? Does it mean also that I have to look for sequence where last_number is: round((known seq num)/20)*20+1

Thank you Bliss, I appreciate your efforts in answering my question very well, so I will save your e-mail in my addressbook for next questions :) if you don't mind.

--

Stjepan Brbot <Stjepan.Brbot_at_ZG.HiNet.HR>


"Bliss" <bliss_is_ignorance_at_hotmail.com> wrote in message
news:3c03ca89_2_at_news.tm.net.my...

> Hi,
>
> When a number is retrieved from sequence, the next "n" values are
cached for
> faster access. You can see this in the Create Sequence command....
When you
> select nextval from the sequence, the Last_Number column in
all_sequences or
> user_sequences will store the last value cached...
>
> E.g.
> SQL> create sequence emp_seq cache 10;
>
> SQL> select emp_seq.nextval from dual;
>
> will display 1
>
> SQL> select sequence_name, cache_size, last_number
> from user_sequences
> where sequence_name = 'EMP_SEQ';
>
> You will see this displays last_number as 11 i.e. 1 (the number just
> generated) + cache_size. The value in the last_number column will
remain as
> 11 till the sequence reaches 11 and then when nextval is selected from
the
> sequence the last_number will be updated to 11 + cache_size.... Hence
the
> last_number does not mean the last value fetched by the sequence, but
means
> the last value cached....
>
> Hope this helps....
>
> A small piece of unasked info which I think may help you....
>
> Before selecting from system tables (all_sequences etc), you can give
> SQL> select column_name, comments
> from all_col_comments
> where table_name = 'SYSTEM TABLE NAME YOU WANT TO SEE'
> this will display the comments on the columns of the table...
>
> Regards,
> Bliss
Received on Tue Nov 27 2001 - 21:43:47 CET

Original text of this message