tags:

views:

318

answers:

1

Hi I am getting this error when trying to create this table. Can you please tell me how I can use on update cascade and on delete set null constraints.

SQL> create table emp3
  2  (
  3  Fname               varchar2(15)not null,
  4  Minit               char,
  5  Lname               varchar(15) NOT NULL,
  6  Ssn                 char(9)     NOT NULL,
  7  Bdate               DATE,
  8  Address             varchar(30),
  9  Sex                 char,
 10  Salary              decimal(10,2),
 11  Super_ssn           char(9) not null,
 12  Dno                 int    default 1 not null,
 13  CONSTRAINT employee PRIMARY KEY (ssn),
 14  CONSTRAINT employeeSUPER FOREIGN KEY(Super_ssn) REFERENCES emp3(Ssn) ON UPD
ATE CASCADE  ON DELETE SET NULL );
CONSTRAINT employeeSUPER FOREIGN KEY(Super_ssn) REFERENCES emp3(Ssn) ON UPDATE C
ASCADE  ON DELETE SET NULL )
                                                                        *
ERROR at line 14:
ORA-00905: missing keyword
+6  A: 

Oracle doesn't have "ON UPDATE CASCADE". So the parser is expecting to see the DELETE keyword where you have UPDATE, because that's the only keyword that should follow ON in that position.

Dave Costa