Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> help with this simple proc?
Morning Gents,
>> Just generate the percentage by creating a fraction solving for that
number of records out of total
>> records in the table. A little trunc or round and you are in
business.
FYI : computing a fraction of the number of rows in the table and passing that to SELECT ... SAMPLE(n) does not work ! I know because I've been down this road myself.
I have an asset tracking system and I have to generate 10 randowm asset numbers each month for our finance departments hardware and software audit. I tried everyhting to get 10 rows out of the SELECT, but the final method is to SELECT from the SELECT with a WHERE ROWNUM < 11 clause.
You can try it for yourself using the SCOTT schema, try selecting 10% of the EMP rows, but do it a few times and see how many different numbers of rows you get back ! I've just tried it using a sample of 10% and got the following number of rows back :
1, 0, 5, 2, 1, 3, 2, 3
all from a 14 row table. I get similar results on my asset table which has 1,266 rows in it, the numbers are :
127, 122, 112, 110, 130, 141, 115, 123
HTH
Regards,
Norman.
Tel: 0113 289 6265 Fax: 0113 289 3146 URL: http://www.Lynx-FS.com -------------------------------------Received on Tue May 06 2003 - 02:58:24 CDT
![]() |
![]() |