請解決我的查詢 Case語句
create trigger DeleteProduct
Before delete on Product
BEGIN
select CASE WHEN ((SELECT Inventory.InventoryID FROM Inventory WHERE Inventory.ProductID = OLD.ProductID and Inventory.Quantity=0) ISNULL)
THEN
RAISE(ABORT,'Error code 82')
Else
DELETE from inventory where inventory.ProductID=OLD.ProductID;
END;
END;
ERROR近DELETE語句
你確定你需要這個觸發?你可以通過外鍵約束中的'on delete cascade'獲得期望的行爲嗎? – SingleNegationElimination