Oracle all tables count Row

Fatih Şahin - Jul 17 '23 - - Dev Community
select owner, table_name, nvl(num_rows,-1) 
from all_tables
WHERE owner = 'XXX'
AND nvl(num_rows,-1) >0
order by nvl(num_rows,-1) desc
Enter fullscreen mode Exit fullscreen mode
select
   table_name,
   to_number(
   extractvalue(
      xmltype(
         dbms_xmlgen.getxml('select count(*) c from '||table_name))
    ,'/ROWSET/ROW/C')) count
from 
   user_tables A
   WHERE TABLE_NAME LIKE 'MOR%'
order by 2 DESC
Enter fullscreen mode Exit fullscreen mode
SELECT
'SELECT COUNT(1),' || ' ''' || TBL.TABLE_NAME || ''' ' || 'AS TABLE_NAME' || ' FROM' || ' ' || TBL.TABLE_NAME || ' UNION ALL' AS COUNTS_ROW
FROM
(
SELECT
TABLE_NAME,
NUM_ROWS COUNTER
FROM DBA_TABLES
WHERE
1=1
AND OWNER = 'UYUMSOFT'
AND TABLE_NAME LIKE 'MORD%'
ORDER BY 2 DESC
) TBL
ORDER BY 1 DESC
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .