| 
		
			| description of constraints in tables [message #55945] | Wed, 26 February 2003 00:43  |  
			| 
				
				
					| 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  |  
			| 
				
				
					| 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.
 |  
	|  |  |