1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

To Drop Integrity constraints regarding

Discussion in 'SQL PL/SQL' started by laxman, Oct 12, 2009.

  1. laxman

    laxman Forum Expert

    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    230
    Location:
    MUMBAI
    Dear sir,
    kindly help me out with problem related to remove integrity constraints.
    suppose i have created one table with following information.

    create table dept
    (
    dept_no number(12),
    dept_name varchar2(10),
    foreign key(dept_no) references emp(dept_no)
    )

    now i want to remove foreign key from this table with following statement

    "Alter table dept drop constraint constrain_name"

    but i am unable to do so,since i forgot to include contstraint constraint_name before foreign key.
     
  2. Sikkandar.S.P

    Sikkandar.S.P Active Member

    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    80
    Location:
    Chennai
    Are you looking for the Constraint Name that has been created on the Dept table?

    Code (Text):

    SQL >SELECT CONSTRAINT_NAME FROM USER_CONSTRAINTS
      2  WHERE
      3  TABLE_NAME = 'DEPT'
      4  /

    CONSTRAINT_NAME
    ------------------------------
    SYS_C0024702

    SQL >ALTER TABLE DEPT DROP CONSTRAINT SYS_C0024702
      2  /

    Table altered.