Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Constraints

Re: Constraints

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Tue, 11 Mar 2003 08:55:08 -0800
Message-ID: <3E6E14EC.4BACE3CF@exesolutions.com>


Scott Staub wrote:

> Using the constraint name, how can I determine the table name and field name
> that the constraint is for?
>
> Thank you in advance,
>
> Scott

SELECT table_name
FROM all_constraints
WHERE constraint_name = '<constraint_name>';

To trace parent-child relationship:

SELECT T.owner AS CHILD_OWNER,

               T.table_name AS CHILD_TABLE,
               T.constraint_name AS FOREIGN_KEY_NAME,
               R.owner AS PARENT_OWNER,
               R.table_name AS PARENT_TABLE,
               R.constraint_name AS PARENT_CONSTRAINT
FROM dba_constraints T, dba_constraints R
WHERE T.r_constraint_name = R.constraint_name
  AND T.r_owner = R.owner
  AND T.constraint_type='R'

AND R.owner = T.owner;

Daniel Morgan Received on Tue Mar 11 2003 - 10:55:08 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US