SQL使用ON UPDATE CASCADE不断出错 [英] SQL Keep getting error with ON UPDATE CASCADE

查看:171
本文介绍了SQL使用ON UPDATE CASCADE不断出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,所以我正在使用此"ON UPDATE CASCADE"功能,但仍然无法正常工作.

Hello everybody so i am working this "ON UPDATE CASCADE" feature and i still can't get it work.

我的第一张桌子:

CREATE TABLE Stab
(
Stab_id int not null,
Sprache VARCHAR2(2000),
Vorname VARCHAR2(2000) not null,
Nachname VARCHAR2(2000) not null,
Geburtsatg date,
Nationalität VARCHAR2(2000),
Geschlecht VARCHAR2(2000) not null,
Kontakt VARCHAR2(2000) not null,
PRIMARY KEY (stab_id)
);

第一张桌子没问题

,我希望第一列"Stab_id"的第二张表(如第一张表)是第一张表的外键.因此,当我更改第一张表的"Stab_id"列中的值时,第二张表的"Stab_id"也将更改.

and i want my 2nd table with the first column "Stab_id" (like in the 1st table) is the foreign key of the 1st table. So when i change values in column "Stab_id" from 1st table, the "Stab_id" from 2nd table will change too.

CREATE TABLE Schauspieler
(
    Stab_id INT not null,
    Filmanzahl number(5,5),

    CONSTRAINT fk_Stabschau
    FOREIGN KEY (stab_id)
    REFERENCES stab (stab_id)
    ON DELETE CASCADE
    ON UPDATE CASCADE);

但是我在更新级联"行下不断收到错误消息

But i keep getting error under the line "ON UPDATE CASCADE"

Fehlerbericht-SQL-Fehler:ORA-00907:缺少右括号 00907. 00000-缺少右括号"

Fehlerbericht - SQL-Fehler: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis"

*原因:
*动作:

*Cause:
*Action:

有人可以帮助我吗? 非常感谢

can someone please help me. Thank you very much

推荐答案

Oracle没有"ON UPDATE CASCADE".您可以使用触发器手动模拟这种行为

Oracle does not have "ON UPDATE CASCADE". You can manually emulate this behavior by using triggers

这篇关于SQL使用ON UPDATE CASCADE不断出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆