Tuesday, December 4, 2018

Finding Columns will null or empty values in Oracle Database Tables

Gather Statistics on the required list of tables.

in SQL developer go to
Connections     -   Your Connection -   Tables (filter your tables) - Right click - Statistics - Gather Statistics

Run SQL

SELECT *
FROM user_tab_columns t
WHERE
  --t.nullable = 'Y' AND
  t.table_name IN ('Table1','Table2')
AND (t.column_name LIKE '%ORG%'
OR t.column_name LIKE '%BU%')
AND t.num_distinct < 2 ;