on 09-18-2014 2:31 PM
Hi,
Is there any simple way to reset a HDBSEQUENCE?
Suppose I have a sequence whose range is 1-100.
In a procedure I need to reset the sequence and use it but for other procedures I need to just use NEXTVAL.
I have seen the syntax of create sequence with RESET BY option, but I want to just reset the sequence to its initial value .
Regards
S.Srivatsan
Hi @ Fernando,
The Alter Sequence is not supported within the procedure.
@ Lars :
I knew it is not a good design but still want to know how to do it...
Thanks
Srivatsan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Srivatsan Sundaravaradan wrote:
In a procedure I need to reset the sequence and use it but for other procedures I need to just use NEXTVAL.
That's a design bug in your application.
If you need independent sequence numbers then use different sequences.
Remember, your code does not have control over the sequence. Any other process might request a new number any time. Resetting it at runtime is plain wrong.
- Lars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried:
ALTER SEQUENCE seq RESTART WITH 1; ?
Cheers,
Fernando
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.