Home » SQL & PL/SQL » SQL & PL/SQL » How to find dependecies on a constraint
How to find dependecies on a constraint [message #209001] Tue, 12 December 2006 22:11 Go to next message
mkranthi
Messages: 2
Registered: December 2006
Junior Member
There is a constraint(unique). Which I have to remove. Before doing that, I have to check whether there are any tables which are dependent on the constraint in a specified schema.

Thanks
kranthi
mkranthikumar@gmail.com Cool
Re: How to find dependecies on a constraint [message #209004 is a reply to message #209001] Tue, 12 December 2006 22:29 Go to previous messageGo to next message
ehegagoka
Messages: 493
Registered: July 2005
Senior Member
hi!,
try user_constraints
Re: How to find dependecies on a constraint [message #209014 is a reply to message #209001] Tue, 12 December 2006 23:15 Go to previous messageGo to next message
venkatesh_mv
Messages: 1
Registered: December 2006
Junior Member
SELECT * FROM USER_CONSTRAINTS WHERE R_CONSTRAINT_NAME = 'CONSTRAINT_NAME'
Re: How to find dependecies on a constraint [message #209021 is a reply to message #209001] Tue, 12 December 2006 23:51 Go to previous messageGo to next message
naiksushma
Messages: 15
Registered: December 2006
Junior Member
you can tried out this query to find out table and columnname :
SELECT * FROM USER_CONS_COLUMNS
WHERE CONSTRAINT_NAME='<YOUR CONSTRAINT NAME>'

Re: How to find dependecies on a constraint [message #209045 is a reply to message #209021] Wed, 13 December 2006 01:12 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
ehegagoka and venkatesh_mv are right: user_constraints is the one you are looking for. You want to find out if there are any foreign key constraints based on your primary key:
SELECT constraint_name, table_name
FROM   user_constraints
WHERE  r_constraint_name = 'YOUR_PRIMARY_KEY'

Note the column I'm using: R_CONSTRAINT_NAME (Name of the unique constraint definition for referenced table)

with user_cons_columns you can find out all the columns involved in that constraint.

MHE
Previous Topic: Format SQL-output (merged)
Next Topic: rows as columns in sql
Goto Forum:
  


Current Time: Mon Dec 05 12:55:19 CST 2016

Total time taken to generate the page: 0.13878 seconds