-2
CREATE TABLE ward
(
wardnumber int NOT NULL PRIMARY KEY,
type varchar(50),
name varchar(50),
numberofrooms int
);

CREATE TABLE Patient
(
patientid int NOT NULL PRIMARY KEY,
empssn int,
category varchar(50),
discount int,
firstname varchar(50),
lastname varchar(50),
address varchar(50),
city varchar(50),
birthdate date,
gender varchar(50),
age date,
cellnumber varchar(50),
bednumber int,
roomnumber int,
wardnumber int ,
diseaseid int,
 constraint fk_ward_number foreign key (wardnumber) references ward(wardnumber)on update cascade,
constraint fk_disease_id foreign key (diseaseid) references disease(diseaseid)
); 

i get the following error regarding the contraint with update cascade thingy , i have tried a lot but dient get fixed help

Error at Command Line : 19 Column : 83 Error report - SQL Error: ORA-00905: missing keyword 00905. 00000 - "missing keyword"

Pரதீப்
  • 91,748
  • 19
  • 131
  • 172
  • 1
    Don't use reserved words as column names: "type", "name" all raise "red flags" with me ... I wouldn't begin to guess at the error until you remove those and retry. – Ditto May 11 '15 at 15:23
  • possible duplicate of [How to create a Foreign Key with "ON UPDATE CASCADE" on Oracle?](http://stackoverflow.com/questions/1289877/how-to-create-a-foreign-key-with-on-update-cascade-on-oracle) – Mark Leiber May 11 '15 at 15:29
  • @MarkLeiber i think you are right oracle doesnt support it – Chaudhry Abdullah May 11 '15 at 15:51

2 Answers2

0

I think there is an issue with your Primary Key.

the correct sentence is

CREATE TABLE table_name
(
  column1 datatype null/not null,
  column2 datatype null/not null,
  ...

  CONSTRAINT constraint_name PRIMARY KEY (column1, column2, ... column_n)
);
Jalkar
  • 71
  • 3
0

"on update cascade," I don't think there's any such thing as UPDATE cascade .. there is a DELETE cascade .. but not UPDATE ... this is causing your error

http://docs.oracle.com/cd/E11882_01/server.112/e41084/clauses002.htm#CJAIHHGC

Ditto
  • 3,256
  • 1
  • 14
  • 28