# Databases > Oracle Inserting nextval after sequence has reached maximum value

## Geek_Guest

What will happen when a sequence has reached the maximum value and we try to insert the nextval of the sequence?  

Eg. A sequence has a maximum value of 999 and it has crossed. Now i try to insert a value through sequence_name.nextval() and the cycle option was not mentioned while creating the sequence. 

Will oracle give a error?

*Question asked by visitor sgmakwana*

----------


## Innila

Hi,

Oracle will definitely throw an error if the sequence exceeds the max value & cycle parameter is not set.
The error will be ORA-08004,

*ORA-08004: sequence SEQ_TEST1.NEXTVAL exceeds MAXVALUE and cannot be instantiated*

----------


## reet_dhiman

well  innila gave the correct reply. if the paramater for returning to the starting value is off then an error will be there else if cycle is present then it ll start from the beginning value. like if we have start value 1
max value 99
then if cycle is there then after 99 it ll start from 1 else will return a value.

----------


## reet_dhiman

i mean ll return a error. hope u get that

----------


## soorajsk_84

try with ALTER SEQUENCE and change the max val property or SET CYCLE property

----------


## debasisdas

Yes oracle will return an error message.

----------


## jmriaz

yes,oracle will surely throw an error.

----------


## Ash4u

ORA-08004: sequence ASHISH.NEXTVAL exceeds MAXVALUE and cannot be instantiated
 This is the error oracle will throw

----------

