Sequences Not Starting With '1' When Used In Insert (Doc ID 1050193.1)

Last updated on MAY 08, 2017

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.1 to 11.2.0.1 [Release 11.2]
Information in this document applies to any platform.

Goal

The sequences created as default ( start with 1 increment by 1) are not staring with '1' when used in insert query script. Instead they are starting with 2 or 4.
This behaviour of sequences is seen in version Oracle11gR2, not seen in earlier versions

drop TABLE test1;
drop sequence seqtest1;
CREATE TABLE test1(sno NUMBER, name VARCHAR(1000));
CREATE SEQUENCE seqtest1;
INSERT INTO test1 VALUES(SEQTEST1.NEXTVAL,'SAM');

select * from test1;
SNO
----------
NAME
------------------------------------------------------------------------------
--
2
SAM

+ CREATE SEQUENCE seqtest2;

+ select SEQTEST2.nextval from dual;


NEXTVAL
----------
1

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms