The goal I’m trying to achieve is to hide a column if all its values result in null or null.
CREATE TABLE m_value_tbl (net_value, net_con,total_net) AS
SELECT cast(NULL as number), cast(0 as number), cast(NULL as number) FROM DUAL
UNION ALL
SELECT cast(NULL as number), cast(2 as number), cast(NULL as number) FROM DUAL ;
The expected result is:
net_value net_con total_net
null 2 null
What I tried is the following:
SELECT
net_value
,net_con
,TOTAL_NET
from m_value_tbl
where
(net_value IS NOT NULL
OR net_con IS NOT NULL
OR total_net IS NOT NULL)
2
You cannot do that using SQL.
If you want to hide columns then this should be done in the programming language that you are calling the database from (i.e. Java, PHP, C#, Python, etc.) as SQL (in any dialect, not just Oracle) and the client applictions that pass SQL queries to the database (SQL*Plus, SQL Developer, TOAD, etc.) do not support conditionally displaying columns based on results.