How to view check constraint properties on column

I have an existing database that was created by someone else.  I want to view the check constraint properties of a couple of columns.  How can I do this via command?
LVL 1
digaratiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SujithData ArchitectCommented:
You can make use of the views
dba_constraints
dba_cons_columns

If you dont have privileges you may use all_constraints and all_cons_columns

The query will look like

select *
from dba_cons_columns
where table_name = upper('<your table name>') and column_name = upper('<your column name>')
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
iozturkCommented:
Use
select * from user_constraints where table_name=upper('tablename');
0
Naveen KumarProduction Manager / Application Support ManagerCommented:
if you have a referential constraint, meaning a particular column in a table
is referring to a primay key column in some other table. For example, EMP table
has a column deptno with a referential constraint referring to deptno column in
DEPT table which is a primary key.

select *
from dba_constraints
where owner ='SCOTT'
and table_name ='EMP'; --> take the r_constraint_name column value from the
                       --> output of this query and put it in the below query
                       --> to see to which table column it is referring to.

select *
from dba_constraints
where owner ='SCOTT'
and constraint_name ='FK_DEPT_CONS' ; --> you can find all other details except
                                      --> column name of the the referential constraint.

select *
from dba_cons_columns
where constraint_name = 'PK_LOPV' ; --> you can find the column name
                                   --> of the referential constraint

Also the constraint type will be 'R' for foreign key constraints, 'P' for
primary key constraint, 'C' for check constraints.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.