Home » SQL & PL/SQL » SQL & PL/SQL » how to use dbs.random package effectively?
how to use dbs.random package effectively? [message #231264] Mon, 16 April 2007 02:42 Go to next message
fazal_haq2001
Messages: 35
Registered: July 2006
Location: India
Member
Hi Friends,
How to use dbs.random package effectively..
I have to generate document no randomly and it will not get duplicated..please give an example..

Regards,
Fazal...
Re: how to use dbs.random package effectively? [message #231266 is a reply to message #231264] Mon, 16 April 2007 02:44 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
By definition, random may generate duplicates.
If a function can't generate duplicates then it is not random.

Regards
Michel
Re: how to use dbs.random package effectively? [message #231272 is a reply to message #231264] Mon, 16 April 2007 03:07 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
The only way I can think of guaranteeing that you don't get duplicates off DBMS_RANDOM would be to store each number (or document id) that you generate in a table with a unique constraint on that column - that way you would get informed when a value had been generated before, and would be able to get another number.
Previous Topic: error in redaing clob record
Next Topic: comparing data of the table using DBLINK
Goto Forum:
  


Current Time: Thu Dec 08 19:55:00 CST 2016

Total time taken to generate the page: 0.15205 seconds