There is a sequence with min value 100.
I want to alter this sequence to min value as 101.
If the table has already data in the sequence column as
100,101,102...
Is it possible to do so ?
Answers were Sorted based on User's Feedback
Answer / kiran kumar
The START WITH Value can not changed using ALTER SEQUENCE
command. The sequence must be dropped and recreate a
sequence in different number.
| Is This Answer Correct ? | 20 Yes | 1 No |
Answer / ranvijay
we can only alter MINVALUE,MAXVALYE,Incremented by and
CACHE of sequence.but not alter START WITH.
Alter sequence sequanceName
incremented by 2
minvalue 101;
| Is This Answer Correct ? | 6 Yes | 4 No |
Answer / pradeep
Or other way around can be rename the current sequence and
create new sequence with the desired values;
SQL> CREATE SEQUENCE SEQ_TET INCREMENT BY 1 START WITH 100
MAXVALUE 1000000 MINVALUE 99;
Sequence created.
SQL> rename SEQ_TET to seq_test;
Table renamed.
SQL> select * from user_sequences;
SEQUENCE_NAME MIN_VALUE MAX_VALUE
INCREMENT_BY C O CACHE_SIZE
------------------------------ ---------- ---------- -------
----- - - ----------
LAST_NUMBER
-----------
SEQ_TEST 99
1000000 1 N N 20
100
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / lova raju allumalla
WE CANNOT ALTER A SEQUENCE START NUMBER BUT IF U WANT TO
CHANGE THE EXISTING DATA IN THE TABLE THEN
ASSUME U HAVE EMPLOYEE TABLE WHERE EMPNO BEGINS WITH 100
UPDATE EMPLOYEE SET EMPNO = EMPNO + 1 WHERE EMPNO IN
(SELECT EMPNO FROM EMPLOYEE);
| Is This Answer Correct ? | 0 Yes | 2 No |
Explain the commit statement.
How do I find duplicates in the same column?
How do I run a sql script?
What is indexing in sql and its types?
How many commands are there in sql?
Explain the concept of normalization.
Is sql a programming?
How do you rename a table in sql?
What is sql scripting?
Can we rollback delete command?
write the Sql query for creating database backup?
How to download oracle sql developer?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)