cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Resetting a sequence

Former Member
0 Likes
3,312

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

View Entire Topic
Former Member
0 Likes

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

lbreddemann
Active Contributor
0 Likes

I didn't write that it was bad design. I wrote it is a bug

You can do it via EXECUTE IMMEDIATE 'ALTER SEQUENCE <seq. name> RESTART WITH <value>'; from within a stored procedure.

But it remains a bug.

- Lars