Results 1 to 8 of 8

Thread: Inserting nextval after sequence has reached maximum value

  1. #1
    Geek_Guest
    Guest

    Inserting nextval after sequence has reached maximum value

    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


  2. #2
    Expert Member
    Join Date
    Sep 2006
    Answers
    130

    Re: Inserting nextval after sequence has reached maximum value

    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

    *** Innila ***

  3. #3
    Junior Member
    Join Date
    Feb 2007
    Answers
    26

    Re: Inserting nextval after sequence has reached maximum value

    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.


  4. #4
    Junior Member
    Join Date
    Feb 2007
    Answers
    26

    Re: Inserting nextval after sequence has reached maximum value

    i mean ll return a error. hope u get that


  5. #5
    Junior Member
    Join Date
    Jun 2007
    Answers
    18

    Re: Inserting nextval after sequence has reached maximum value

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


  6. #6
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Inserting nextval after sequence has reached maximum value

    Yes oracle will return an error message.


  7. #7
    Junior Member
    Join Date
    May 2007
    Answers
    5

    Re: Inserting nextval after sequence has reached maximum value

    yes,oracle will surely throw an error.


  8. #8
    Junior Member
    Join Date
    Jun 2007
    Answers
    8

    Re: Inserting nextval after sequence has reached maximum value

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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact