Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法确定使用 constraint with cascade delete 或不在触发器内发生删除?
否 - 当删除一行时,将触发适当的触发器,但没有导致删除的“上下文”。但是,在AFTER DELETE触发器中,您可以检查主记录是否存在 - 如果不存在,则很有可能删除是由ON DELETE CASCADE约束触发的,而不是因为用户在行上发出“直接” DELETE。
AFTER DELETE
ON DELETE CASCADE
DELETE