Oracle: Finding Columns with only null values

Posted by Jorge Valois on Stack Overflow See other posts from Stack Overflow or by Jorge Valois
Published on 2011-01-07T16:46:01Z Indexed on 2011/01/07 16:54 UTC
Read the original article Hit count: 160

Filed under:
|

I have a table with a lot of columns and a type column.

Some columns seem to be always empty for a specific type.

I want to create a view for each type and only show the relevant columns for each type. Working under the assumption that if a column has ONLY null values for a specific type, then that columns should not be part of the view, how can you find that out with queries?

Is there a SELECT [columnName] FROM [table] WHERE [columnValues] ARE ALL [null]

I know I COMPLETELY made it all up above... I'm just trying to get the idea across. Thanks in advance!

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle