Re: problem about Sequence

From: Michael Krolewski <vandra_at_u.washington.edu>
Date: Sat, 31 Oct 1998 00:59:29 -0800
Message-ID: <363AD171.F8B5AB9D_at_u.washington.edu>


Sequences are yet another object in the Oracle database much like a table or a view.
It is stored in its own area.

To access the information you can look at all_sequences or user_sequences.

A simple method is to look at the sequence current value

    eg select user_id_seq.currval into someValue from dual;

the nextval function increments the sequence and returns the value currval returns the current value. The current value is the current maximum of the sequence.

mike krolewski

Ken Ho Kwok Fai wrote:

> I made a sequence in a table "test" by the following SQL:
>
> ============================================================
> create table registration
> (user_id number NOT NULL primary key,
> user_name varchar2(11)
> );
>
> create sequence user_id_seq start with 1 increment by 1 nocycle;
> =============================================================
>
> After I insert some values to the table, how could I know the
> max sequence number? Is there a table to store the sequence? I don't want
> to select it from the table and the compare the largest number as it
> needs a lot of time. Any method that could allow me to get the max
> sequence number? Thanks a lot.
>
> --
> Regards,
> Ken Ho
Received on Sat Oct 31 1998 - 09:59:29 CET

Original text of this message