You're in luck - there's a fast and easy way to get this information using optimizer statistics.
After a large data load the statistics should be gathered anyway. Counting NULLs is something the statistics gathering already does. With the default settings since 11g, Oracle will count the number of NULLs 100% accurately. (But remember that the number will only reflect that one point in time. If you add data later, the statistics must be re-gathered to get newer results.)
Sample schema
create table test1(a number); --Has non-null values. create table test2(b number); --Has NULL only. create table test3(c number); --Has no rows. insert into test1 values(1); insert into test1 values(2); insert into test2 values(null); commit;
Gather stats and run a query
begin dbms_stats.gather_schema_stats(user); end; / select table_name, column_name, num_distinct, num_nulls from user_tab_columns where table_name in ('TEST1', 'TEST2', 'TEST3');
Using the NUM_DISTINCT and NUM_NULLS you can tell if the column has non-NULLs (num_distinct > 0), NULL only (num_distinct = 0 and num_nulls > 0), or no rows (num_distinct = 0 and num_nulls = 0).
TABLE_NAME COLUMN_NAME NUM_DISTINCT NUM_NULLS ---------- ----------- ------------ --------- TEST1 A 2 0 TEST2 B 0 1 TEST3 C 0 0
OracleandSQL Serverare not the same ?select count(col1), count(col2) from tableshould gives you what you wanted