Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to generate specified Random

Re: How to generate specified Random

From: TurkBear <johng_at_mm.com>
Date: 1998/08/14
Message-ID: <35d45dc2.8401510@news2.mm.com>#1/1

Try this:

Select doctor_name from doctor_table where doctor_spec = 'Dentist' and rownum < 2
union
Select doctor_name from doctor_table where doctor_spec = 'Radiologist' and rownum < 2 union
............

This will return a random set of the specs specified in the where clauses... Oracle stores randomly so, if you do not use an 'order by...' clause it will return a row at random ( not scientifically random, just not ordered or predictable )

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.
>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.
>

To reply please remove the 'nospam' part of the address Received on Fri Aug 14 1998 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US