Re: How to generate specified Random

From: Dave Wotton <Dave.Wotton_at_no-spam.it.camcnty.gov.uk>
Date: 1998/08/14
Message-ID: <6r1m3c$gn2$1_at_dns.camcnty.gov.uk>#1/1


> Johnny Tjokro <tjokroj_at_ibm.net> 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.

Use the random number generator mentioned in the thread:

    PL-SQL Random Number Generator?

in comp.databases.oracle.tools yesterday ( Thurs 13th Aug 1998 ).

[Quoted] Assuming you've got a numeric identifier on your doctors file, it's simply a matter of

     select .....
       from doctors
      where doctor_id = rand_max(2000)

where rand_max is the random number generator function written by Thomas Kyte, and reproduced in that thread.

[Quoted] If you haven't got a numeric id, you'll have to use rownum ( but this will be inefficient )

    select ....

      from doctors
     where rownum = rand_max(2000)

Dave.

--
Remove the no-spam bit from my email address to reply.
Received on Fri Aug 14 1998 - 00:00:00 CEST

Original text of this message