Re: How do I determine the start number in a sequence from SQL ?
Date: 1995/08/29
Message-ID: <41v7em$12eb_at_muddy.huber.com>#1/1
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.
-- -- ============================================================ Donald A. Smith No, that was JOHN Smith eddas_at_huber.com I have never met PocahontasReceived on Tue Aug 29 1995 - 00:00:00 CEST