Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Sequence LAST_NUMBER in Oracle [duplicate]

Tags:

oracle

Possible Duplicate:
How do I reset a sequence in Oracle?

I would like to change one parameter of sequence LAST_NUMBER to some number, how can i do it through SQL query.

ALTER SEQUENCE MSG_MESSAGE_SEQUENCE RESTART WITH 97

And it is not working.

like image 321
Brijesh Avatar asked Nov 13 '22 20:11

Brijesh


1 Answers

From here:

'select MSG_MESSAGE_SEQUENCE.nextval from dual' INTO l_val;

execute immediate
'alter sequence ' || p_seq_name || ' increment by 97 - ' || l_val || ' minvalue 97';
like image 176
CristiC Avatar answered Mar 08 '23 09:03

CristiC