I have a set of tables in Oracle and I would like to identify the table that contains the maximum number of rows.
So if, A has 200 rows, B has 345 rows and C has 120
The table in your schema that has max rows:
with data as
(
select table_name,
to_number(extractvalue(xmltype(
dbms_xmlgen.getxml (
' select count(*) c from ' || table_name)),
'/ROWSET/ROW/C')) countrows
from user_tables
)
select table_name, countrows
from data
where countrows = (select max(countrows)
from data);
dbms_xmlgen.getxml(' select .... ') is extremely flexible.