Navigation

Search

Categories

On this page

How to change start number of an Oracle Sequence

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 291
This Year: 0
This Month: 0
This Week: 0
Comments: 0

Sign In
Pick a theme:

# Sunday, January 13, 2008
Sunday, January 13, 2008 10:50:49 PM (GTB Standard Time, UTC+02:00) ( Oracle )

Connected to Oracle Database 10g Enterprise Edition Release 10.1.0.5.0

Connected as sysadm

 

 

SQL> create sequence mt_seq

2 start with 1

3 increment by 1;

 

Sequence created

 

SQL> select mt_seq.nextval from dual;

 

NEXTVAL

----------

1

 

SQL> alter sequence mt_seq start with 1000;

 

alter sequence mt_seq start with 1000

 

ORA-02283: cannot alter starting sequence number

 

SQL> alter sequence increment by 999;

 

alter sequence increment by 999

 

ORA-02277: invalid sequence name

 

SQL> alter sequence mt_seq increment by 999;

 

Sequence altered

 

SQL> select mt_seq.nextval from dual;

 

NEXTVAL

----------

1000

 

SQL> alter sequence mt_seq increment by 1;

 

Sequence altered

 

SQL> select mt_seq.nextval from dual;

 

NEXTVAL

----------

1001

 

SQL> ------

SQL>

SQL>

SQL> drop sequence mt_seq;

 

Sequence dropped

 

SQL> create sequence mt_seq

2 start with 1000

3 increment by 1;

 

Sequence created

 

SQL> select mt_seq.nextval from dual;

 

NEXTVAL

----------

1000

 

SQL>