view constraints on table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bubli
    New Member
    • Dec 2008
    • 2

    view constraints on table

    how to view the constraints on the table like the indexes created etc in sql.Its urgent ..
  • anijos
    New Member
    • Nov 2008
    • 52

    #2
    Hi

    You can use USER_CONSTRAINT S or ALL_CONSTRAINTS to see all the constraints peresent on a table

    Try

    Select * from all_constraints
    where table_name = 'your_table'

    The Constraint_Type column will tell you the type of constraint.


    Regards,
    AniJos

    Comment

    • Pilgrim333
      New Member
      • Oct 2008
      • 127

      #3
      Hi,

      Most tools like TOAD and PL/SQL Developer make it able for you to see it in the interface under the table.

      Pilgrim.

      Comment

      • kingoracle
        New Member
        • Nov 2008
        • 8

        #4
        hi you can use user_constraint s to find the results from the data dict.


        regards
        Rahul

        Comment

        • bubli
          New Member
          • Dec 2008
          • 2

          #5
          hi,i tried using the query "select * from all_constraints ....",but could not find any result.Regards, bubli

          Comment

          • amitpatel66
            Recognized Expert Top Contributor
            • Mar 2007
            • 2358

            #6
            For Indixes:

            [code=oracle]

            select * from user_indexes WHERE table_name=''

            [/code]

            For Constraints:

            [code=oracle]

            select * from user_constraint s WHERE table_name=''

            [/code]

            Comment

            • debasisdas
              Recognized Expert Expert
              • Dec 2006
              • 8119

              #7
              Originally posted by bubli
              hi,i tried using the query "select * from all_constraints ....",but could not find any result.Regards, bubli
              try to specify the owner as well with name of the object.

              Comment

              • vasanthkumar14
                New Member
                • Feb 2017
                • 2

                #8
                It doesn't work in ORACLE 11g

                Comment

                • vasanthkumar14
                  New Member
                  • Feb 2017
                  • 2

                  #9
                  SQL> select * from all_constraints where table_name='dep artments';

                  no rows selected

                  I tried to view the constraints in the built-in schema @amitpatel66

                  Comment

                  Working...