select only columns that are not empty oracle sql code example
Example 1: select only columns that are not empty oracle sql
select COLUMN_NAME
from sys.all_tab_columns col
inner join sys.all_tables t on col.owner = t.owner
and col.table_name = t.table_name
where
col.table_name = 'SHRDGMR'
AND (NUM_DISTINCT > 0 or density > 0)
order by col.column_id;
Example 2: select only columns that are not empty oracle sql
select COLUMN_NAME
from sys.all_tab_columns col
inner join sys.all_tables t on col.owner = t.owner
and col.table_name = t.table_name
where
col.table_name = 'REPLACE THIS WITH YOUR TABLE NAME'
AND NUM_DISTINCT > 0
order by col.column_id;