For constraint validation i want to read unique key and not null column from oracle11g, I could able to retrieve same from Mysql but don't know how to do it in Oracle 11g
Asked
Active
Viewed 86 times
0
1 Answers
0
You need to join [DBA|ALL|USER]_CONSTRAINTS
view with [DBA|ALL|USER]_CONS_COLUMNS
view.
NOT NULL constraint is type C
.
UNIQUE constraint is type U
.
SELECT a.table_name,
b.column_name,
a.constraint_type
FROM dba_constraints a
JOIN dba_cons_columns b
ON a.owner = b.owner
AND a.constraint_name = b.constraint_name
AND a.table_name = b.table_name
AND a.owner ='<user_name>'
AND a.constraint_type IN ('U', 'C');

Lalit Kumar B
- 47,486
- 13
- 97
- 124
-
Using above query i could able to see
where unique key and not null is applied, but i want to retrieve actual
– KUNAL SHARMA Oct 13 '15 at 09:58on which these constraint are applied ? Please let me know how i will do so.. -
Ok, I modified the answer. Please mark it as answered, would help others. – Lalit Kumar B Oct 13 '15 at 10:07
-
@KUNALSHARMA You're welcome! – Lalit Kumar B Oct 13 '15 at 11:31