Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7644031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:35:22+00:00 2026-05-31T09:35:22+00:00

I’ve develop the following sequence on a ORACLE 10 DB wich autoincrement an id

  • 0

I’ve develop the following sequence on a ORACLE 10 DB wich autoincrement an id column of a table named t_client by 1 (A trigger is developed also and execute when new data on this table is registered)

The issue is that sometimes the sequecce doesn’t increment by 1, if not in 21. I doesn’t really find the issue by it’s increment by 21. Here is the code sample

Secuence ClientConsecutive

CREATE SEQUENCE  user_owner.ClientConsecutive
MINVALUE 0 
MAXVALUE 999999999999999999999999999 
INCREMENT BY 1 
START WITH 1 
CACHE 20 
NOORDER NOCYCLE ;

Trigger_Client_ID

create or replace
TRIGGER user_owner.TRIGGER_CLIENT_ID 
BEFORE INSERT ON T_CLIENT
REFERENCING NEW AS NEW FOR EACH ROW
DECLARE valueSequence NUMBER := 0;
BEGIN
SELECT ClientConsecutive.NEXTVAL INTO valorSecuencia FROM DUAL;
:NEW.ID_CLIENTE := valueSequence;
END;

When the application associated to this objects executes it, on the SQLdeveloper looking for the sequence details sometimes it visualizes

LAST_NUMBER 2

which is correct when I register new data on the empty table but sometimes says

LAST_NUMBER 21

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:35:24+00:00Added an answer on May 31, 2026 at 9:35 am

    Oracle sequences are not guaranteed to be gap-free. In fact, you can all but guarantee that there will occasionally be gaps.

    In your case, you’re using the default cache size of 20. When the database is shut down or the sequence cache is aged out of memory, whatever values were part of the sequence cache will be lost. So if the cache holds the numbers 1-20 initially, you do a nextval that returns a value 1, and the cache ages out of SGA before you call nextval again, you’d expect to get a value of 21 the next time you call nextval.

    You can reduce the frequency of gaps by reducing the CACHE size on the sequence to 1. That will not eliminate gaps– there will still, for example, be cases where a transaction gets rolled back, for example. And it will decrease performance. In general, you shouldn’t be concerned with gaps since sequence-generated primary keys are, by definition, merely supposed to be unique identifiers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.