Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2013
    Posts
    11

    ORA-02264: name already used by an existing constraint

    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
    /

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,616
    02264, 00000, "name already used by an existing constraint"
    // *Cause: The specified constraint name has to be unique.
    // *Action: Specify a unique constraint name for the constraint.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Don't say, show. Don't promise, prove.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •