Find the tables that contains more than 100 rows

>>Script Language and Platform: Oracle
This script finds the tables that contain more than 100 rows.

Author: Praveen Kumar Chugh(09818276143)



create or replace function rowcount(tname varchar2) return number is
x number;
stmt varchar2(200);
begin
stmt := ‘select count(*) from ‘||tname;
execute immediate stmt into x;
return x;
exception when no_data_found then
return 0;
end;
/
Select table_name, rowcount(table_name) from cat where rowcount(table_name) >= 100;



Disclaimer:
We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…

Disclaimer Continued

Back to Database Journal Home

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles