oracle: sampling statement

Hi,

I've wrote a statement which generates 150.000 rec's, randomized it and now
I would like to export 1st 10.000 rows (take the sample of data) but don't
know how (?)
I would appreciate any help

BR

KrunoG
KrunoG [ Mo, 18 September 2006 10:30 ] [ ID #1470222 ]

Re: oracle: sampling statement

On Mon, 18 Sep 2006 10:30:46 +0200, "KrunoG" <bezovogRad.astronomija [at] gmail.com>
wrote:

>I've wrote a statement which generates 150.000 rec's, randomized it and now
>I would like to export 1st 10.000 rows (take the sample of data) but don't
>know how (?)
>I would appreciate any help

You mentioned "1st" which implies ordering, so order in a subquery, and use
"rownum <= 10000" in the outer query to get only that many rows.

Or you've also mentioned sampling; Oracle has a "sample" clause that you can
use to get a percentage of the data:


http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b 14200/statements_10002.htm#i2065953

--
Andy Hassall :: andy [at] andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Andy Hassall [ Mo, 18 September 2006 23:05 ] [ ID #1470224 ]

Re: oracle: sampling statement

"Andy Hassall" <andy [at] andyh.co.uk> wrote in message
news:gb2ug29t6cqqg4c5kb2qhbmnjcjtrv58i7 [at] 4ax.com...

> You mentioned "1st" which implies ordering, so order in a subquery, and
use
> "rownum <= 10000" in the outer query to get only that many rows.
>
> Or you've also mentioned sampling; Oracle has a "sample" clause that you
can
> use to get a percentage of the data:
>
>
>
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b 14200/statements_10002.htm#i2065953
>
> --
> Andy Hassall :: andy [at] andyh.co.uk :: http://www.andyh.co.uk
> http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool


I've tried this but It's not working
ORDER BY dbms_random.valuerownum <= 10000
KrunoG [ Di, 19 September 2006 09:33 ] [ ID #1471469 ]

Re: oracle: sampling statement

Sorry, I've hit enter before ending post :|

ORDER BY dbms_random.value

rownum <= 10000

I have problem with sampling because of multiple table joins. I realize that
every query is individual, perhaps a whole code could give a clue (?)
KrunoG [ Di, 19 September 2006 09:39 ] [ ID #1471470 ]
PHP » alt.php.sql » oracle: sampling statement

Vorheriges Thema: Help with query
Nächstes Thema: Looking for the right mysql syntax