Home » SQL & PL/SQL » SQL & PL/SQL » CREATE Table Error (ORACLE 10g Windows)
CREATE Table Error [message #308152] Fri, 21 March 2008 11:10 Go to next message
jamesn2007
Messages: 5
Registered: January 2008
Location: Duluth
Junior Member
Hi,

I get the following error when trying to create a table:
SQL Error: ORA-02270: no matching unique or primary key for this column-list

I'm not sure what I'm doing wrong. Here's the SQL statement:
	CREATE TABLE ION_CODES (
 	  ID				NUMBER(10,0) NOT NULL,
	  CODE 				VARCHAR2(20) NOT NULL,
	  DESCRIPTION 			VARCHAR2(240) NOT NULL,
	  LONG_DESCRIPTION		VARCHAR2(4000),
	  USAGE_WATER_YN		CHAR(1) DEFAULT 'N' NOT NULL,
	  USAGE_SOIL_YN			CHAR(1) DEFAULT 'N' NOT NULL,
	  USAGE_NONSOIL_YN		CHAR(1) DEFAULT 'N' NOT NULL,
	  REVIEWER_ENTERED_YN		CHAR(1) DEFAULT 'N' NOT NULL,
	  COMMENTS			VARCHAR2(4000),
	  CODE_STATUS			VARCHAR2(8) DEFAULT 'New' NOT NULL,
	  CREATED_TIMESTAMP		DATE DEFAULT SYSDATE NOT NULL,
	  MODIFIED_TIMESTAMP		DATE,
          AUDIT_USER_ID_FK		NUMBER(10,0) DEFAULT -1 NOT NULL,
	  RECORD_STATUS 		VARCHAR2(8) DEFAULT 'New' NOT NULL,
	  CONSTRAINT ION_CODES_PK PRIMARY KEY(ID),
	  CONSTRAINT ION_CODES_USER_FK FOREIGN KEY(AUDIT_USER_ID_FK)
	    REFERENCES USERS(ID),
	  CONSTRAINT ION_CODES_REC_STATUS_CK CHECK (RECORD_STATUS IN ('New','Modified','Deleted')),
          CONSTRAINT ION_CODES_STATUS_CK  CHECK (CODE_STATUS IN ('New','Modified','Active','Inactive')),
	  CONSTRAINT ION_CODES_REV_ENTER_CK CHECK (REVIEWER_ENTERED_YN IN ('Y','N')),
	  CONSTRAINT ION_CODES_WATER_CK  CHECK (USAGE_WATER_YN IN ('Y','N')),
	  CONSTRAINT ION_CODES_SOIL_CK  CHECK (USAGE_SOIL_YN IN ('Y','N')),
	  CONSTRAINT ION_CODES_NONSOIL_CK  CHECK (USAGE_NONSOIL_YN IN ('Y','N'))
	)
	PCTFREE 5
	;

[Updated on: Fri, 21 March 2008 11:11]

Report message to a moderator

Re: CREATE Table Error [message #308154 is a reply to message #308152] Fri, 21 March 2008 11:19 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
>REFERENCES USERS(ID) is this a Primary key?
Re: CREATE Table Error [message #308155 is a reply to message #308152] Fri, 21 March 2008 11:23 Go to previous message
jamesn2007
Messages: 5
Registered: January 2008
Location: Duluth
Junior Member
Think I figured it out. I copied the table users from a different schema without copying its retraints. I recreated the Users table and then ran my code and it worked.
Previous Topic: ORA-00904: invalid column name--HELP! query is working in pl/sqldev tool but not in shell script
Next Topic: Procedure for every date between the date period
Goto Forum:
  


Current Time: Sun Dec 11 08:16:01 CST 2016

Total time taken to generate the page: 0.07300 seconds