SQL 不断收到 ON UPDATE CASCADE 错误

2021-12-06 00:00:00 sql oracle

大家好,我正在使用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);

但是我在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:

谁能帮帮我.非常感谢

推荐答案

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

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

相关文章