Home » RDBMS Server » Server Administration » random select
random select [message #371338] Wed, 04 October 2000 14:27 Go to next message
CARLOS
Messages: 24
Registered: February 2000
Junior Member
Hi, I need to select n random lines from the table. Anyone can help me? I'm stuck!

Regards,
Carlos
Re: random select [message #371339 is a reply to message #371338] Wed, 04 October 2000 15:01 Go to previous messageGo to next message
priscilla Gathoni
Messages: 1
Registered: October 2000
Junior Member
Use the following syntax:

proc sql;
create table tablename as select *,
ranuni(-1) as random
from yourlib.yourdata;
order by variablename, random;
if first.variablename then count=0;
count+1;
if count <= n then output;
quit;
Re: random select [message #371340 is a reply to message #371339] Wed, 04 October 2000 15:27 Go to previous message
CARLOS
Messages: 24
Registered: February 2000
Junior Member
Sorry, but I'm really new to oracle... this oracle database was installed and used by another person which is not here since last week. Now I need the information.

I got the idea of you script (except for the create table), but where I run it? Where I got the results? SQL Plus? Enterprise Manager? Thanx!

Regards,
Carlos
Previous Topic: Re: Oracle migration from sun/solaris to os/390 references???
Next Topic: Patch for 816 ? or upgrate to 817 ?
Goto Forum:
  


Current Time: Thu Mar 28 03:02:12 CDT 2024