#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    76
    Rep Power
    12

    show primary key


    Hi, I'm using the oracle db. Let said I have the table ac_cardholder. What is the sql command to get know the primary key?
    Thank you!
    SQL> desc ac_cardholder;
    Name Null? Type
    ------------------------ ----------- --------------
    ACCH_CARDNO NOT NULL VARCHAR2(10)
    ACCH_ICNO VARCHAR2(12)
    ACCH_ID NOT NULL VARCHAR2(16)
    ACCH_NAME VARCHAR2(60)
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    You will need to look in the ALL_CONSTRAINTS table where the tablename = 'ac_cardholder'
    El éxito consiste en una serie de pequeñas victorias día a día

    MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    68
    Rep Power
    11
    As victorpendleton says, you should query the ALL_CONSTRAINTS view:

    select * from ALL_CONSTRAINTS
    where CONSTRAINT_TYPE = 'P' and
    TABLE_NAME = 'AC_CARDHOLDER'

    Good Day,
    Dan

IMN logo majestic logo threadwatch logo seochat tools logo