sql - Selecting all tables with no records -


I need to display all the tables that have zero records.

I tried,

  select from user_all_tables * where (select count (*) from count_in_tables = 0;  

But it does not seem to work. How should I go about redesigning this question? Thank you.

If all of your tables are analyzed, you can see the column num_rows The user_tables of the table.

Otherwise, you will need PL / SQL to do this work. It will output all the tables of your current user without record (use all_tables if you need other users' tables):

 Set up  Turn on server output; Announce the CNT PLS_INTEGER; Start for C (Choose table_name from user_tables) Perform the loop immediately Select 'Count (*) to' c.table_name || ' "Where rownum = 1 'innt cnt; if (cnt = 0) then dbms_output.pot_line (ctb_name); if end; end loop; end;  

Comments