Selecting Random Records for Auditing

PL/SQL 
 
SELECT  *
FROM    (
        SELECT  *
        FROM    mytable
        ORDER BY
                dbms_random.value
        )
WHERE rownum <= 1000
 
http://www.orafaq.com/wiki/SQL_FAQ#Can_one_retrieve_only_the_Nth_row_from_a_table.3F 

http://www.orafaq.com/wiki/SQL_FAQ#Can_one_retrieve_only_rows_X_to_Y_from_a_table.3F

No comments:

Post a Comment