Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Setting up constraints

Setting up constraints

From: Aaron Rouse <aaron_rouse_at_yahoo.com>
Date: 16 May 2002 10:44:23 -0700
Message-ID: <a57b6daf.0205160944.3a54fc1a@posting.google.com>


I am trying to setup some contraints in Oracle 8i and for some reason I am getting told by Oracle that ID is not a primary key and it errors out on that. However in the attached SQL, I set the column ID as a PK up top along with PQUESTIONID. Where might my error lie in this SQL? It errors out before it gets to the very last constraint, so erroring out on the second to last constraint.



--Remove QDEPNDENCY PK

ALTER TABLE QDEPENDENCY DROP CONSTRAINT PK_QDEPENDENCY;
--Add new QDEPENCY PK

ALTER TABLE QDEPENDENCY ADD CONSTRAINT PK_QDEPENDENCY PRIMARY KEY (ID, PQUESTIONID);
--Add QDEPENDLISTS PK

ALTER TABLE QDEPENDLISTS ADD CONSTRAINT PK_QDEPENDLISTS PRIMARY KEY (QDEPENDID, LISTITEMID);
-- Add constraint for deletion of Dependents
ALTER TABLE COILSAFE.QDEPENDLISTS
 ADD CONSTRAINT REM_QDEPENDLISTS
 FOREIGN KEY (QDEPENDID)
 REFERENCES COILSAFE.QDEPENDENCY (ID)
 ON DELETE CASCADE;
-- Add constraint for deletion of Questions
ALTER TABLE COILSAFE.QDEPENDENCY
 ADD CONSTRAINT REM_QDEPENDENCY
 FOREIGN KEY (PQUESTIONID)
 REFERENCES COILSAFE.FRMQUESTIONS (ID)
 ON DELETE CASCADE; Received on Thu May 16 2002 - 12:44:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US