dbms_random in trigger

From: Glen A Stromquist <glen_stromquist_at_no.spam.yahoo.com>
Date: Fri, 25 Apr 2003 20:53:07 GMT
Message-ID: <Tehqa.106449$dh1.2320335_at_news0.telusplanet.net>



[Quoted] I have created a table with a field called "random' that will hold a random number that will be generated before insert via a simple trigger which consists of:

declare
x number;
begin
x :=dbms_random.random;
:new.random := x;
end;

This works ok, but I'd like to limit the random numbers to the same range as rows in the table, and I'm not sure how to use the dbms_rand.initialize to accomplish this.

The idea behind this is to be able to pick X records at random from this table, and have the random numbers regenerate when I update a certain field.

ideas?

TIA Received on Fri Apr 25 2003 - 22:53:07 CEST

Original text of this message