dbTalk Databases Forums  

Oracle skip numbers

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Oracle skip numbers in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
vasilis
 
Posts: n/a

Default Oracle skip numbers - 02-12-2008 , 02:53 AM






Hello,

When using Powerbuilder with Oracle, in some cases oracle skips numbers.
What I mean is that when the ID column has a value of 100, instead of
getting the next value(101) I get 102 or 103 anything but not the next. It
updates the same row from 100 to 103 and of course as you might imagine I
can not retrieve the row of 100. How this problem may be solved(Not updating
the id column to a different value).

Thanks in advance.



Reply With Quote
  #2  
Old   
news.verizon.net
 
Posts: n/a

Default Re: Oracle skip numbers - 02-12-2008 , 04:10 AM







"vasilis" <vasilisk (AT) ics (DOT) forth.gr> wrote

Quote:
Hello,

When using Powerbuilder with Oracle, in some cases oracle skips numbers.
What I mean is that when the ID column has a value of 100, instead of
getting the next value(101) I get 102 or 103 anything but not the next. It
updates the same row from 100 to 103 and of course as you might imagine I
can not retrieve the row of 100. How this problem may be solved(Not
updating the id column to a different value).

Thanks in advance.

Why do you care? It is a column that is a surrogate key, it is a
meaningless number.
There are several reasons.
1. If some other session did an insert then a rollback the number would
"skip".
2. If the sequence cache gets aged out of the shared pool then it would
"skip".
3. If you shut down and restart the db then the cached values will be
"lost".

You can solve it, but the scalability of the application will go down the
tubes.

Again, why do you care? You shouldn't be relying on it not skipping.
Jim




Reply With Quote
  #3  
Old   
news.verizon.net
 
Posts: n/a

Default Re: Oracle skip numbers - 02-12-2008 , 04:10 AM




"vasilis" <vasilisk (AT) ics (DOT) forth.gr> wrote

Quote:
Hello,

When using Powerbuilder with Oracle, in some cases oracle skips numbers.
What I mean is that when the ID column has a value of 100, instead of
getting the next value(101) I get 102 or 103 anything but not the next. It
updates the same row from 100 to 103 and of course as you might imagine I
can not retrieve the row of 100. How this problem may be solved(Not
updating the id column to a different value).

Thanks in advance.

Why do you care? It is a column that is a surrogate key, it is a
meaningless number.
There are several reasons.
1. If some other session did an insert then a rollback the number would
"skip".
2. If the sequence cache gets aged out of the shared pool then it would
"skip".
3. If you shut down and restart the db then the cached values will be
"lost".

You can solve it, but the scalability of the application will go down the
tubes.

Again, why do you care? You shouldn't be relying on it not skipping.
Jim




Reply With Quote
  #4  
Old   
news.verizon.net
 
Posts: n/a

Default Re: Oracle skip numbers - 02-12-2008 , 04:10 AM




"vasilis" <vasilisk (AT) ics (DOT) forth.gr> wrote

Quote:
Hello,

When using Powerbuilder with Oracle, in some cases oracle skips numbers.
What I mean is that when the ID column has a value of 100, instead of
getting the next value(101) I get 102 or 103 anything but not the next. It
updates the same row from 100 to 103 and of course as you might imagine I
can not retrieve the row of 100. How this problem may be solved(Not
updating the id column to a different value).

Thanks in advance.

Why do you care? It is a column that is a surrogate key, it is a
meaningless number.
There are several reasons.
1. If some other session did an insert then a rollback the number would
"skip".
2. If the sequence cache gets aged out of the shared pool then it would
"skip".
3. If you shut down and restart the db then the cached values will be
"lost".

You can solve it, but the scalability of the application will go down the
tubes.

Again, why do you care? You shouldn't be relying on it not skipping.
Jim




Reply With Quote
  #5  
Old   
news.verizon.net
 
Posts: n/a

Default Re: Oracle skip numbers - 02-12-2008 , 04:10 AM




"vasilis" <vasilisk (AT) ics (DOT) forth.gr> wrote

Quote:
Hello,

When using Powerbuilder with Oracle, in some cases oracle skips numbers.
What I mean is that when the ID column has a value of 100, instead of
getting the next value(101) I get 102 or 103 anything but not the next. It
updates the same row from 100 to 103 and of course as you might imagine I
can not retrieve the row of 100. How this problem may be solved(Not
updating the id column to a different value).

Thanks in advance.

Why do you care? It is a column that is a surrogate key, it is a
meaningless number.
There are several reasons.
1. If some other session did an insert then a rollback the number would
"skip".
2. If the sequence cache gets aged out of the shared pool then it would
"skip".
3. If you shut down and restart the db then the cached values will be
"lost".

You can solve it, but the scalability of the application will go down the
tubes.

Again, why do you care? You shouldn't be relying on it not skipping.
Jim




Reply With Quote
  #6  
Old   
vasilis
 
Posts: n/a

Default Re: Oracle skip numbers - 02-12-2008 , 05:07 AM



Thanks for your response,

I care about it because when I retrieve the row I use the first value
inserted not the updated one which might be or might be not the nextval on
the same cell. Since you say I can solve it do you know how?

Thanks you
"news.verizon.net" <kennedyii (AT) verizon (DOT) net> wrote

Quote:
"vasilis" <vasilisk (AT) ics (DOT) forth.gr> wrote in message
news:formr8$1kg9$1 (AT) ulysses (DOT) noc.ntua.gr...
Hello,

When using Powerbuilder with Oracle, in some cases oracle skips numbers.
What I mean is that when the ID column has a value of 100, instead of
getting the next value(101) I get 102 or 103 anything but not the next.
It updates the same row from 100 to 103 and of course as you might
imagine I can not retrieve the row of 100. How this problem may be
solved(Not updating the id column to a different value).

Thanks in advance.

Why do you care? It is a column that is a surrogate key, it is a
meaningless number.
There are several reasons.
1. If some other session did an insert then a rollback the number would
"skip".
2. If the sequence cache gets aged out of the shared pool then it would
"skip".
3. If you shut down and restart the db then the cached values will be
"lost".

You can solve it, but the scalability of the application will go down the
tubes.

Again, why do you care? You shouldn't be relying on it not skipping.
Jim




Reply With Quote
  #7  
Old   
vasilis
 
Posts: n/a

Default Re: Oracle skip numbers - 02-12-2008 , 05:07 AM



Thanks for your response,

I care about it because when I retrieve the row I use the first value
inserted not the updated one which might be or might be not the nextval on
the same cell. Since you say I can solve it do you know how?

Thanks you
"news.verizon.net" <kennedyii (AT) verizon (DOT) net> wrote

Quote:
"vasilis" <vasilisk (AT) ics (DOT) forth.gr> wrote in message
news:formr8$1kg9$1 (AT) ulysses (DOT) noc.ntua.gr...
Hello,

When using Powerbuilder with Oracle, in some cases oracle skips numbers.
What I mean is that when the ID column has a value of 100, instead of
getting the next value(101) I get 102 or 103 anything but not the next.
It updates the same row from 100 to 103 and of course as you might
imagine I can not retrieve the row of 100. How this problem may be
solved(Not updating the id column to a different value).

Thanks in advance.

Why do you care? It is a column that is a surrogate key, it is a
meaningless number.
There are several reasons.
1. If some other session did an insert then a rollback the number would
"skip".
2. If the sequence cache gets aged out of the shared pool then it would
"skip".
3. If you shut down and restart the db then the cached values will be
"lost".

You can solve it, but the scalability of the application will go down the
tubes.

Again, why do you care? You shouldn't be relying on it not skipping.
Jim




Reply With Quote
  #8  
Old   
vasilis
 
Posts: n/a

Default Re: Oracle skip numbers - 02-12-2008 , 05:07 AM



Thanks for your response,

I care about it because when I retrieve the row I use the first value
inserted not the updated one which might be or might be not the nextval on
the same cell. Since you say I can solve it do you know how?

Thanks you
"news.verizon.net" <kennedyii (AT) verizon (DOT) net> wrote

Quote:
"vasilis" <vasilisk (AT) ics (DOT) forth.gr> wrote in message
news:formr8$1kg9$1 (AT) ulysses (DOT) noc.ntua.gr...
Hello,

When using Powerbuilder with Oracle, in some cases oracle skips numbers.
What I mean is that when the ID column has a value of 100, instead of
getting the next value(101) I get 102 or 103 anything but not the next.
It updates the same row from 100 to 103 and of course as you might
imagine I can not retrieve the row of 100. How this problem may be
solved(Not updating the id column to a different value).

Thanks in advance.

Why do you care? It is a column that is a surrogate key, it is a
meaningless number.
There are several reasons.
1. If some other session did an insert then a rollback the number would
"skip".
2. If the sequence cache gets aged out of the shared pool then it would
"skip".
3. If you shut down and restart the db then the cached values will be
"lost".

You can solve it, but the scalability of the application will go down the
tubes.

Again, why do you care? You shouldn't be relying on it not skipping.
Jim




Reply With Quote
  #9  
Old   
vasilis
 
Posts: n/a

Default Re: Oracle skip numbers - 02-12-2008 , 05:07 AM



Thanks for your response,

I care about it because when I retrieve the row I use the first value
inserted not the updated one which might be or might be not the nextval on
the same cell. Since you say I can solve it do you know how?

Thanks you
"news.verizon.net" <kennedyii (AT) verizon (DOT) net> wrote

Quote:
"vasilis" <vasilisk (AT) ics (DOT) forth.gr> wrote in message
news:formr8$1kg9$1 (AT) ulysses (DOT) noc.ntua.gr...
Hello,

When using Powerbuilder with Oracle, in some cases oracle skips numbers.
What I mean is that when the ID column has a value of 100, instead of
getting the next value(101) I get 102 or 103 anything but not the next.
It updates the same row from 100 to 103 and of course as you might
imagine I can not retrieve the row of 100. How this problem may be
solved(Not updating the id column to a different value).

Thanks in advance.

Why do you care? It is a column that is a surrogate key, it is a
meaningless number.
There are several reasons.
1. If some other session did an insert then a rollback the number would
"skip".
2. If the sequence cache gets aged out of the shared pool then it would
"skip".
3. If you shut down and restart the db then the cached values will be
"lost".

You can solve it, but the scalability of the application will go down the
tubes.

Again, why do you care? You shouldn't be relying on it not skipping.
Jim




Reply With Quote
  #10  
Old   
Frank van Bortel
 
Posts: n/a

Default Re: Oracle skip numbers - 02-12-2008 , 07:12 AM



On Feb 12, 9:53 am, "vasilis" <vasil... (AT) ics (DOT) forth.gr> wrote:
Quote:
Hello,

When using Powerbuilder with Oracle, in some cases oracle skips numbers.
What I mean is that when the ID column has a value of 100, instead of
getting the next value(101) I get 102 or 103 anything but not the next. It
updates the same row from 100 to 103 and of course as you might imagine I
can not retrieve the row of 100. How this problem may be solved(Not updating
the id column to a different value).

Thanks in advance.
Oracle does not skip numbers, your application does (helped
by the end user):
User: "let's do an insert"
Application: "Ok - you'll need a new number then"
RDBMS: "Here's 101 - the next one will be 102"
User: "time for coffee..."
....[other users happily inserting, and using 102, 103, 104...]
User: "What's this screen? Let's clear it and start over"
Application: "OK all values reset and cleared"

Meaning: your user just "used" number 101. Your app reserved that
number
by requesting it too early, it should have requested it at commit time.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.