Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Finding Not Null Constraints
Sorry about my first reply on using the SEARCH_CONDITION; I did not read your posting carefully enough; otherwise I would have found out that you already tried my solution.
Your other option would be to use the NULLABLE field in the
USER_TAB_COLUMNS:
SELECT a.table_name||'.'||a.column_name||, DECODE(a.nullable,'N','NOT
NULL','CHECK CONSTRAINT')
FROM user_tab_columns a, user_constraints b
WHERE a.table_name=b.table_name
AND a.column_name=b.column_name
AND b.constraint_type='C';
Values for NULABLE column are: N if there is a NOT NULL constraint on the table or if the column is part of a PRIMARY KEY constraint; Y if the column accepts NULL values.
The only problem with this approach is if you have both a NOT NULL and a CHECK constraint on that column.
Sorry for my first reply.
Michael Serbanescu
-----------------------------------------------------------------------John Hough wrote: