Domanda

I have a table with 260 columns, I just want to see only columns with nulls in it. I know there are a few longer versions to see that information but is there an quicker way ? Thanks Gurus

È stato utile?

Soluzione

SELECT  t.column_name
FROM    user_tab_columns t
WHERE   t.nullable = 'Y' AND t.table_name = 'mytable' AND t.num_distinct = 0

Also,before running it update your statistics:

BEGIN
DBMS_STATS.gather_database_stats();
END

Altri suggerimenti

If your question is about displaying Nullable table columns, look @Mihai...

You can definitely write dynamic Pl/Sql to build and execute a statement containing only columns that contain null. You can use series of loops, Ref_cursor, Execute Immediate, oracle data dictionaries, etc.

But if you would be able to, you would know already.

Regularly, you can select some data where certain values are null. E.g.

 Select * From myTable where Col1 is null or col2 is null... -- 258 more columns

This will return all 260 columns, N rows where at least one column is Null

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top