只有在及个别的情况下会导致区别,前者是在其他约束的动作之后执行,后者具有最高的优先权执行。
一个例子:(DB2 SQL Reference Vol 2, 383页)
Table T1 is a parent of table T3; delete rule as noted below.
Table T2 is a parent of table T3; delete rule CASCADE.
CREATE VIEW V1 AS SELECT * FROM T1 UNION ALL SELECT * FROM T2
DELETE FROM V1
If table T1 is a parent of table T3 with a delete rule of RESTRICT, a restrict
violation will be raised (SQLSTATE 23001) if there are any child rows for
parent keys of T1 in T3.
If table T1 is a parent of table T3 with a delete rule of NO ACTION, the
child rows may be deleted by the delete rule of CASCADE when deleting
rows from T2 before the NO ACTION delete rule is enforced for the deletes
from T1. If deletes from T2 did not result in deleting all child rows for
parent keys of T1 in T3, then a constraint violation will be raised
(SQLSTATE 23504)
添加新评论0 条评论