GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Tech FAQs  >  PL/SQL

 Print  |  
Question:  How to write a query or procedure or function to retrieve all the tables from database where the table dont have any data (no rows).

Answer: Database has 100 tables and some of the tables dont have any data. I want to pullout those table names from database in Oracle.


October 10, 2007 13:13:27 #2
 ravgopal   Member Since: October 2007    Total Comments: 7 

RE: How to write a query or procedure or function to r...
 
Analyze and perform statistics on whole schema.  This will populate the statistics details about each table.  You can pull NUM_ROWS column from all_tables to check whether it contains zero.

step1: exec dbms_stats.gather_database_stats;

Step2 : select table_name from all_tables where num_rows=0;
     

 

Back To Question