+ 2

Foreign Key Constraint with ON DELETE CASCADE ON UPDATE CASCADE

I am creating the SQL table below: Create TABLE lawyer (Lyr_lf_name varchar2(45), Lyr_name varchar2(30) Constraint pk_lyr Primary Key, Lyr_emp# varchar2(11) Constraint nn_emp# Not Null Constraint unq_emp Unique, Lyr_qual varchar2(37) Constraint nn_qual Not Null, Lyr_exp smallint Constraint nn_exp Not Null, Constraint fk_lwf Foreign Key (lyr_lf_name) References law_firm (Lf_name) ON Delete Cascade ON UPDATE Cascade ); I want to find out why am I getting an error on “ON delete cascade on update cascade” portion. It is saying I am missing a right parentheses. I am just not sure where and why I would need to add a parentheses? I would appreciate any help thanks.

22nd Sep 2018, 5:23 PM
Xavier Reyes
Xavier Reyes - avatar
6 odpowiedzi
+ 1
I am a sql server user so I did not know that Missing right parenthesis is a strange error. But it looks like there is no "update cascade" I found this link when googling. https://community.oracle.com/thread/829160 unfortunately the link with the solution is no longer found.
22nd Sep 2018, 9:10 PM
sneeze
sneeze - avatar
+ 2
thank you for the help
22nd Sep 2018, 9:40 PM
Xavier Reyes
Xavier Reyes - avatar
+ 1
Oracle 10g
22nd Sep 2018, 8:46 PM
Xavier Reyes
Xavier Reyes - avatar
+ 1
and yes it is allowed
22nd Sep 2018, 8:46 PM
Xavier Reyes
Xavier Reyes - avatar
+ 1
Cool glad you foundation it.
22nd Sep 2018, 9:41 PM
sneeze
sneeze - avatar
0
Which sql do you use ? Is varchar2 a correct datatype ? Constraint nn_emp# is it allowed to use #
22nd Sep 2018, 8:43 PM
sneeze
sneeze - avatar