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

From: YourNameHere <LoginName_at_medtronic.com>
Date: 1995/08/29
Message-ID: <41vqt3$and_at_gazette.medtronic.COM>#1/1


In article <41v7em$12eb_at_muddy.huber.com>, eddas_at_huber.com (Don Smith) says:
>
>
>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 Pocahontas

I believe you can only find the minimum value of the sequence by 'Select Min_Value From User_Sequences Where Sequence_Name = 'Your_Sequence'. But the very first number generated by that sequence could be larger than the minimum value in case of a ascending sequence and i have no idea of finding the sequence number with the it was started .

Chinmay Sahu
chinmay.sahu_at_medtronic.com Received on Tue Aug 29 1995 - 00:00:00 CEST

Original text of this message