Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Randomly pick
Niall Litchfield wrote:
>
> would this not give the same results each time? I can't see this doing
> anything other than a full table scan and then filtering. i.e. Oracle would
> use the same access path each time?
> curious
>
> --
> Niall Litchfield
> Oracle DBA
> Audit Commission UK
> "TurkBear" <noone_at_nowhere.com> wrote in message
> news:taap5t0lrnqke2o7c36qoo983gl3e3noj7_at_4ax.com...
> >
> > A simple, altho' not scientifically random in the true sense, is to do a
> > non-ordered no index select like:
> >
> > Select * from big_table where rownum < 100001;
> >
> > Since data is stored in Oracle in non-defined ( and hence, randomlike )
order
> > the100,000 rows returned will be sort of random...
> >
> > There are better and more scientific methods but if all you need is a
> > non-specific set of records, that should do it...
> >
> >
> > "Anna Henson" <anna_henson_at_yahoo.com> wrote:
> >
> > >Dear Oracle users,
> > >
> > >Please show me how to write a query to randomly picked 100,000 accounts
from
> > >a table that has about 10 million accounts.
> > >Thank you for your help.
> > >
> > >
> > >Anna Henson
> > >
> >
I cannot think of one offhand, but there are many Web sites with SQL scripts and PL/SQL functions on them, one of which is a random-number generator, which you could then use to determine whether to select a row or not.
Good hunting,
Yours,
Geoff Houck
systems hk
hksys_at_teleport.com
http://www.teleport.com/~hksys
Received on Fri Jan 12 2001 - 00:06:30 CST
![]() |
![]() |