Hello,
I need to write a routine that counts how many not null values each column in a database has.
The first idea might be to loop over all_tables / all_tab_cols and write a select like
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM '||table_name||' WHERE '||column_name||' IS NOT NULL' INTO v_count;
Yet this would mean a full table scan for every non indexed column. That's pretty much when I have a maximum of 59 columns for one table and millions of rows.
Any better idea? I don't need the exact count. E.g. for the number of rows in a table I simply use all_tables.num_rows.
Regards
Marcus