Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle sequence - primary key in cycle

Re: Oracle sequence - primary key in cycle

From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 20 Dec 2005 09:25:22 -0800
Message-ID: <1135099508.499610@jetspin.drizzle.com>


ijj_at_o2.pl wrote:
> Hi,
>
> I have a table in a data warehouse which has reached its limit for
> autogenerated primary key - a signed 32 bit integer which can be a
> decimal number from -2147483648 to 2147483647 (I use Informatica
> PowerCenter, ETL tool, which creates it like that).
>
> However, many rows are deleted from this table and because of that some
> values of primary key are currently not used, so it looks like:
> 1,2,5,10, 24, 15, ..... and so on.
>
> I have a question how Oracle sequence should look like when I would
> like to generate primary keys in cycle, checking if the next value of
> the PK is already used in the table (no insert/update) or not (insert).
>
> I would be very grateful for answer.
>
> Iza

Mark has answered your question with respect to sequence generated numbers. But what why not deal with the root cause: A bad design. Why do you need a surrogate key at all? And if you do ... it seems one that is non-numeric would make a lot more sense.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Tue Dec 20 2005 - 11:25:22 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US