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: random records

Re: random records

From: gazzag <gareth_at_jamms.org>
Date: 12 Jul 2006 03:09:51 -0700
Message-ID: <1152698991.817894.127870@75g2000cwc.googlegroups.com>


Faby wrote:

> Hi, I have to select 50 random records from a table. How should i
> proceed? Should I use "sample", "dbms_random.value"...?
> Thanks

If you want to list the first X amount of records that Oracle stumbles across in a particular table, check out the ROWNUM pseudo-column.

For example:

SQL> select object_name
  2 from all_objects
  3 where rownum <= 10;

OBJECT_NAME



/1005bd30_LnkdConstant
/10076b23_OraCustomDatumClosur
/10297c91_SAXAttrList
/103a2e73_DefaultEditorKitEndP
/1048734f_DefaultFolder
/10501902_BasicFileChooserUINe
/105072e7_HttpSessionBindingEv
/106ba0a5_ArrayEnumeration
/106faabc_BasicTreeUIKeyHandle
/10744837_ObjectStreamClass2

10 rows selected.

HTH -g Received on Wed Jul 12 2006 - 05:09:51 CDT

Original text of this message

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