I am using Oracle - SQL developer
Want to check the count of null values for each column .
Currently I am using the below to achieve results.
select COLUMN_NAME from all_tab_columns where table_name = 'EMPLOYEE'
SELECT COUNT (*) FROM EMPLOYEE WHERE <Column_name1> IS NULL
UNION ALL
SELECT COUNT (*) FROM EMPLOYEE WHERE <Column_name2> NULL
UNION ALL
SELECT COUNT (*) FROM EMPLOYEE WHERE <Column_name3> IS NULL
UNION ALL ......................
How can we use bind value to run the below query like
DEFINE Column_name = Column_name1
SELECT COUNT (*) FROM EMPLOYEE WHERE &&Column_name IS NULL .
NUM_NULLSinall_tab_columnswould have the number ofNULLvalues in this table. Provided the table has stats updated!! Any data inserted/updated without gathering stats would result in wrong answer. To know about stats you can refer Oracle Docs