문제

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

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top