Home » RDBMS Server » Server Administration » description of constraints in tables
description of constraints in tables [message #55945] Wed, 26 February 2003 00:43 Go to next message
mary
Messages: 19
Registered: November 1999
Junior Member
How to get the description of the table along with the description of the constraints present ,in sqlplus ?
"User_constraints" just gives the Constraint's names.
Can we find the description of the constraints( such as
FOREIGN KEY references primary key of which table)of various tables?

Is there any means to get the details of the relationship existing b/w the tables in SQLPLUS in Unix??
Re: description of constraints in tables [message #55948 is a reply to message #55945] Wed, 26 February 2003 02:09 Go to previous message
Vikas Gupta
Messages: 115
Registered: February 2002
Senior Member
You can use the following script:

SELECT CON.OWNER,
CON.TABLE_NAME,
CON.CONSTRAINT_NAME,
CON.R_CONSTRAINT_NAME,
COL.COLUMN_NAME,
COL.POSITION,
CON1.OWNER,
CON1.TABLE_NAME "Ref Tab",
CON1.CONSTRAINT_NAME "Ref Const"
FROM DBA_CONSTRAINTS CON1,
DBA_CONS_COLUMNS COL,
DBA_CONSTRAINTS CON
WHERE CON.OWNER = 'HRMSNAR'
AND CON.CONSTRAINT_TYPE = 'R'
AND COL.OWNER = CON.OWNER
AND COL.TABLE_NAME = CON.TABLE_NAME
AND COL.CONSTRAINT_NAME = CON.CONSTRAINT_NAME
AND CON1.OWNER = CON.OWNER
AND CON1.CONSTRAINT_NAME = CON.R_CONSTRAINT_NAME
AND CON1.CONSTRAINT_TYPE IN ( 'P', 'U' )

Regards,

Vikas.
Previous Topic: Trace sqlplus
Next Topic: ORA-00600: internal error code, arguments: [sorsik_2]
Goto Forum:
  


Current Time: Thu Sep 19 22:43:19 CDT 2024