有关删除级联和有关更新级联

有关删除级联和有关更新级联

本文介绍了SQL,有关删除级联和有关更新级联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是SQL新手,遇到了一个奇怪的问题.所以我有两张桌子供应商.这是供应商表.

I am new to SQL and I encountered a weird problem. So I have two tables OFFERS andSUPPLIER. Here is the Supplier table.

CREATE TABLE  "SUPPLIER"
   (    "S#" NUMBER,
    "NAME" VARCHAR2(50),
    "CITY" VARCHAR2(50),
     PRIMARY KEY ("S#") ENABLE
   )

这是OFFERS表.

CREATE TABLE  "OFFERS"
   (    "P#" NUMBER,
    "S#" NUMBER,
    "V#" NUMBER,
    "PR#" NUMBER,
      CONSTRAINT "PK_OFFERS" PRIMARY KEY ("P#") ENABLE
   )

所以现在,当我尝试像这样向offers表添加外键约束

So now, when I try to add a Foreign key constraint to the offers table like this

ALTER TABLE OFFERS
ADD CONSTRAINT FK_SUPPLIERS FOREIGN KEY(S#)
 REFERENCES SUPPLIER (S#)
ON DELETE CASCADE
ON UPDATE CASCADE

我收到一条错误消息:"ORA-01735:无效的ALTER TABLE选项".如果我删除最后一行,即"ON UPDATE CASCADE",则可以正常工作.那么,我在做什么错呢?我在互联网上看到了很多类似的例子,这些例子本来可以工作,所以我有点困惑.如果有任何区别,我正在apex.oracle.com上工作.

I get an error saying : "ORA-01735: invalid ALTER TABLE option". If I remove the last line, which is "ON UPDATE CASCADE" this works perfectly fine. So, what am I doing wrong? I've seen a lot of examples like this on the internet, that are supposed to work, so I am kinda confused. I am working on apex.oracle.com if that makes any difference.

推荐答案

Oracle中没有更新级联":

There is no "on update cascade" in Oracle as far as I know (even in current versions):

http://asktom .oracle.com/pls/asktom/f?p = 100:11:0 ::::: P11_QUESTION_ID:5773459616034

这篇关于SQL,有关删除级联和有关更新级联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 08:28