Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to generate specified Random
Try this (semi SQL semi pseudo code)
select count(*) into specialists
form doc_table
where doc_specialty = 'Cancer'; -- and this my be a parameter
n := 1;
n_stop := rand_max (specialists); -- as in
-- http://www.oracle.com/st/products/features/random_down2.html
for doc_register in (select * from doc_table where doc_specialty =
'Cancer')
loop
if n = n_stop
then
-- I have my specialist in doc_register; exit when 0=0;
Johnny Tjokro wrote:
> Hi,
> I have ORACLE 7.3.3.4 that is sitting on UNIX
> The script that I am working on is :
>
> Let say I have lists of doctor's names. Each list is group by the
> doctor specialty.
> i.e. : Cancer, Plastic Surgery, Radiology, Dentist etc.
>
> What I am trying to achieve is :
> Let say I want to find a Dentist. And there are 2000 dentists on the
> list.
> Therefore, the script should randomly pick one out of 2000.
> OR
> I want to find a Radiologist. There are 300 radiologists on the list.
> Therefore, the script should randomly pick one out of 300.
>
> Any help would be appreciated.
Received on Sun Aug 16 1998 - 00:00:00 CDT