请问我怎么能在触发这样的东西但没有IF?有可能??
...
IF NEW.value IS NULL THEN
DELETE FROM table WHERE column IS NULL;
ELSE
DELETE FROM table WHERE column=NEW.value;
END IF;
当值为null时练习,因此删除列为null的行以及设置值时删除行= column = value 我想在没有IF
的触发器中使用它答案 0 :(得分:1)
您可以在一个声明中执行此操作:
...
DELETE FROM table WHERE column IS NULL OR column=NEW.value;
...
修改强>
DELETE FROM table WHERE (NEW.value IS NULL AND column IS NULL) OR (NEW.value IS NOT NULL AND column = NEW.value)
答案 1 :(得分:0)
我认为如果/ else:
,这将与你的功能完全相同DELETE FROM table WHERE (NEW.value IS NULL AND column IS NULL) OR (column=NEW.value)