/DROP TABLE STATEMENTS/
DROP TABLE BRANCH CASCADE CONSTRAINT PURGE;
DROP TABLE SCREEN CASCADE CONSTRAINT PURGE;
DROP TABLE SESSIONS CASCADE CONSTRAINT PURGE;
DROP TABLE MOVIE CASCADE CONSTRAINT PURGE;

/CREATE TABLE STATEMENT/

CREATE TABLE BRANCH(
BRANCHID CHAR(2)NOT NULL,
BRANCHNAME VARCHAR2(20),
BRANCHSUBURB VARCHAR2(15),
BRANCHPOSTCODE CHAR(4),
CONSTRAINT BRANCH_PK PRIMARY KEY(BRANCHID));

CREATE TABLE SCREEN(
SCREENID CHAR(2) NOT NULL,
BRANCHID CHAR(2) NOT NULL,
SCREENCAPACITY NUMBER(3),
CONSTRAINT SCREEN_PK PRIMARY KEY(BRANCHID,SCREENID),
CONSTRAINT SCREEN_FK1 FOREIGN KEY(BRANCHID)REFERENCES BRANCH(BRANCHID));

CREATE TABLE MOVIE(
MOVIEID CHAR(2) NOT NULL,
MOVIENAME VARCHAR(20),
MOVIEGENRE VARCHAR(20),
MOVIECLASSIFICATION VARCHAR(5),
CONSTRAINT MOVIE_PK PRIMARY KEY(MOVIEID));

CREATE TABLE SESSIONS(
SESSIONID CHAR(4),
BRANCHID CHAR(2)NOT NULL,
SCREENID CHAR(2)NOT NULL,
MOVIEID CHAR(2)NOT NULL,
SESSIONDATE DATE,
SESSIONPRICE NUMBER(4,2),
CONSTRAINT SESSIONS_PK PRIMARY KEY(SESSIONID),
CONSTRAINT SESSIONS_FK1 FOREIGN KEY(BRANCHID)REFERENCES BRANCH(BRANCHID),
CONSTRAINT SESSIONS_FK2 FOREIGN KEY(SCREENID)REFERENCES SCREEN(SCREENID),
CONSTRAINT SESSIONS_FK3 FOREIGN KEY(MOVIEID)REFERENCES MOVIE(MOVIEID));

can you guy help me out? i dont know why i have this error. i checked many time there seems no wrong spelling. plz show me why i have ERROR ORA - 02270.

show me how to fix it?
thank you very much

You cannot set combined primary key CONSTRAINT SCREEN_PK PRIMARY KEY(BRANCHID,SCREENID)
The unique index may combine two (or more) fields eg UNIQUE(BRANCHID,SCREENID)

Most Probably when you have a missing Primary key is not defined from parent table. then It occurs

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.