Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Distinct Random Number Generation
Hello Matthew,
Dont you think the method you are thinking to adopt may hit
performance issue, when your products get large, and your random number
keeps hitting IDs that are used ??
And if you say there are alot more random numbers than there are
products, then you shouldnt run out of numbers in the first place...
Just my 2 cents worth
Steve
Matthew D. Heilman wrote:
> Here is the scenario. I want to generate a unique number so I can
> assign it
> as the indentifier of some attribute. I have a table that looks like:
>
> product_ID NUMBER(10) --Primiary key
> product_descr VARCHAR2(255)
>
> So, each time I have a new product_descr I want to assign it a unique
> product_ID. I was planning to have the font end generate a random
> number(or
> even have oracle do it) and then check if this number already exists
> in the
> table. But I do not want to have to query the table each time to see
> if a
> newly generated random number exists. I also can not use a counter,
> because
> I will be deleting products and I may run out of number eventually(I
> will be
> processing HUGE amounts of products).
>
> Any suggestions?
Received on Fri May 15 1998 - 09:55:19 CDT
![]() |
![]() |