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

Thread: How to determine whether primary key exists on a Table

  1. #1
    Join Date
    Mar 2001
    Location
    New York , New York
    Posts
    577
    Hi,

    How do I determine if a primary Key exists on a particular table and if yes on which columns.

    Ronnie
    ronnie_yours@yahoo.com

    You can if you think you can.

  2. #2
    Join Date
    Mar 2002
    Location
    Mesa, Arizona
    Posts
    1,204

    select * from dba_constraints where table_name = '' and constraint_type = 'P'

    select * from dba_cons_columns where table_name = ''


    -Ken


    [Edited by KenEwald on 03-13-2002 at 10:46 AM]

  3. #3
    Join Date
    Oct 2001
    Location
    Madrid, Spain
    Posts
    763
    Hi Ronnie,

    You shall check the dba_constraints the column constraint_type(if it is P, then it is primary key) for this table.

    And with the PK name you shall query the all_cons_columns for the column_name for this pk.

    Regards

    Angel

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