| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to find the index for a constraint
In article <3B2698B8.387AC3CE_at_attws.com>, "Daniel A. Morgan" <Daniel.Morgan_at_attws.com> wrote:
> Lothar Armbrüster wrote: >
> > Using user_constraints, user_con_columns, user_indexes, and > user_ind_columns you are looking for a unique index where the columns in > the index match the columns in the primary key constraint.
Or, you may want to try:
undef tablename
undef owner
select o.name indexname,
c.con#,
con.name constraintname
from obj$ o,
cdef$ c,
con$ con
from obj$
where name = '&tablename'
and type#=2
and owner#=(select user#
from user$
where name='&owner'
)
)
Given a TABLE_NAME and OWNER, this will find the name of the PRIMARY KEY constraint, as well as the unique index that's enforcing it.
-Mark Received on Tue Jun 12 2001 - 23:25:49 CDT
![]() |
![]() |