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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: FROM SRINIVAS -HELP

Re: FROM SRINIVAS -HELP

From: Jared Still <jkstill_at_cybcon.com>
Date: Mon, 27 Aug 2001 18:56:04 -0700
Message-ID: <F001.0037903F.20010827190621@fatcity.com>

Some requirements please:

is it ok if a row is chosen more than once?

it will be statistically impossible to pick 10 million rows from a set of 44 million without many duplicates.

if it is ok, just write a pl/sql script to loop through the table, skip a random number of rows, grab one, repeat.

you will likely have to scan the table multiple times.

not very efficient. but hey!, I'm just the idea man here. :)

if you don't want duplicates, you will need to track those that you have already chosen and skip them. this has the potential to be a very long running script.

why not just go throught the entire table once, pick every 4th row, and be done with it?

Not random, but just how important is randomness to you? you didn't state the purpose of this exercise.

Jared

On Monday 27 August 2001 09:00, Srinivas_Madala_at_circuitcity.com wrote:
> I have 44 million records in my table.I need to extract the 10 million
> records randomly,how to retrieve these records randomly. I used the
> dbms_random.sql ,but I have a doubt that I was correct or not.
> can U please guide me or just send a piece of code.
> Thanking U
> srinivas

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jared Still
  INET: jkstill_at_cybcon.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Aug 27 2001 - 20:56:04 CDT

Original text of this message

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