Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: random records
Not as elegant as the SAMPLE solution, but I used the following two
functions. First is to get random number between two limits, and the
second selects the records that is to be chosen from in bulk into a
netsted table and then I select one of the results using the random
number function.
function random_number(p_max number, p_min number default 0, p_multiply number default 1) return number isx int;
end random_number;
type t_temp_string is table of varchar2(1000) index by binary_integer;
nt_temp_string t_temp_string; -- Our temp string to keep the results from the SQL
begin
end random_sql_result;
but the SAMPLE seems much better.
Hope it helps
Regards
B
##############################
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
Received on Thu Jul 13 2006 - 04:52:10 CDT