Oracle: Finding Columns with only null values

前端 未结 8 2082
温柔的废话
温柔的废话 2021-01-17 21:11

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 o

8条回答
  •  余生分开走
    2021-01-17 21:30

    After looking at @Gerrat and @BQ's comments, I thouht I could get the details I need in the following way: I have a legacy table that has N different types. All types share columns, and have exclusive columns.

    I can create a view for each type with all columns, then use all_tab_columns to get all column names where the "num_nulls" is less than the total number of rows for that specific type.

    From there it should be easy to gather columns that are used for each type and create the views.

    Thoughts?

提交回复
热议问题