DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Dumb question.

  1. #1
    Join Date
    Mar 2001
    Posts
    11

    Question

    I know hot to disabled and enabled constraints.

    How do I check for constraints for any given tables?

    is there somekind of querry that I can run, to find out?


    thank you,

  2. #2
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    If you are a dba then you can use the dba_constraints, if you are a user then you can use the user_constraints to view all the constrains under your schema.

    SELECT * FROM dba_constraints;

    or

    SELECT * FROM user_constraints;

    Good luck,
    Sam

    [Edited by sambavan on 03-19-2001 at 03:33 PM]
    Thanx
    Sam



    Life is a journey, not a destination!


  3. #3
    Join Date
    Mar 2001
    Posts
    71
    query user_constraints table to see STATUS column for
    particular constraint.

    e.g.
    select constraint_name,status from user_constraints
    where table_name = 'TABLE1';

  4. #4
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    No question is a dumb question.

    There is a table called dba_constraints that keeps up with what constraints are on which tables. The main columns you will want to look at are probably owner, constraint_name, constraint_type (P is PK, U is UK, R is FK, C is Check), table_name, r_owner (referencing owner), r_constraint_name (referencing constraint).

    select owner, constraint_name, constraint_type
    from dba_constraints
    /
    Jeff Hunter

  5. #5
    Join Date
    Feb 2001
    Posts
    123
    If you do not have access to DBA_CONSTRAINTS, you might be better off using the ALL_CONSTRAINTS view, rather than USER_CONSTRAINTS.

    ALL_CONSTRAINTS gives all the constraints that you have the privileges to see, whereas USER_CONSTRAINTS only has the constraints that you own.

    HTH

    David.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width