Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

ORA-02264: name already used by an existing constraint

$
0
0
Sorry for ANOTHER thread but here's the thing I am trying to achieve.

Here is the tables I am trying to connect in diagram view:

http://i46.tinypic.com/a6r.jpg

I am trying to link the Part-no but it keeps giving the error mentioned in the title


The batch table:
Code:

CREATE TABLE  "BATCH"
  (        "BATCH-NO" NUMBER(10,0),
        "PART-NO" NUMBER(10,0) NOT NULL ENABLE,
        "FACTORY-NO" NUMBER(5,0) NOT NULL ENABLE,
        "CONTAINER-NO" NUMBER(5,0) NOT NULL ENABLE,
        CONSTRAINT "BATCH_CON" PRIMARY KEY ("BATCH-NO") ENABLE
  )
/

CREATE OR REPLACE TRIGGER  "BI_BATCH"
  before insert on "BATCH"             
  for each row 
begin 
  if :NEW."BATCH-NO" is null then
    select "BATCH_SEQ".nextval into :NEW."BATCH-NO" from dual;
  end if;
end;

/
ALTER TRIGGER  "BI_BATCH" ENABLE
/

Code:

CREATE TABLE  "PART"
  (        "PART-NO" NUMBER(9,0) NOT NULL ENABLE,
        "NAME" VARCHAR2(50 CHAR),
        "MANUFACTURING-ROUTE-NUMBER" NUMBER(9,0),
        "DRAWING-ADDRESS" VARCHAR2(50 CHAR),
        CONSTRAINT "PART_PK" PRIMARY KEY ("PART-NO") ENABLE
  )
/
ALTER TABLE  "PART" ADD CONSTRAINT "PART_CON" FOREIGN KEY ("MANUFACTURING-ROUTE-NUMBER")
          REFERENCES  "MANUFACTURING-ROUTE" ("M-ROUTE-NO") ENABLE
/

CREATE OR REPLACE TRIGGER  "BI_PART"
  before insert on "PART"             
  for each row 
begin 
  if :NEW."PART-NUMBER" is null then
    select "PART_SEQ".nextval into :NEW."PART-NUMBER" from dual;
  end if;
end;

/
ALTER TRIGGER  "BI_PART" ENABLE
/


Viewing all articles
Browse latest Browse all 13329

Trending Articles