Re: How do I determine the start number in a sequence from SQL ?

From: Nicholas Ambrose <nambrose_at_lssec.bt.co.uk>
Date: 1995/08/31
Message-ID: <423qmg$c18_at_sol.lssec.bt.co.uk>#1/1


In article <41v7em$12eb_at_muddy.huber.com>, eddas_at_huber.com (Don Smith) writes:
|>
|> In article <28AUG199515472754_at_cc.weber.edu>, ylew_at_cc.weber.edu (Yee Lew) writes:
|> |> In article <1995Aug28.185301.22691_at_media.mit.edu>, Yezdi Lashkari <yezdi> writes..
|> |> [snip]
|> |>
|> |> How about: SELECT your_sequence_name.CURRVAL
|> |> FROM dual;
|> |>
|> |> This gets you the current value in the sequence or the start value in the
|> |> sequence if the sequence has not been used.
|> |>
|> |> Regards,
|> |>
|> |> Yee
|> |> Oracle Consultant
|>
|> Unfortunately, currval doesn't work unless you've already done a nextval. So
|> you can't check the sequence number in this manner except by changing it. But
|> you can do
|> select last_number from user_sequences
|> where sequence_name = 'YOUR_SEQUENCE_NAME';
|>
|> if you own the sequence (otherwise use the "all_sequences" view).
|>
|> But I think the original poster wanted to find the starting sequence number
|> when the sequence was created. I don't know that this is possible.
Would that perhaps be the MIN_VALUE column from all_sequences ? it looks reasonable...
Nick Received on Thu Aug 31 1995 - 00:00:00 CEST

Original text of this message