【发布时间】:2017-06-17 07:50:01
【问题描述】:
这个新的租赁历史表的触发器,防止从表中删除。
CREATE OR REPLACE TRIGGER RENTALHIS_DEL
BEFORE DELETE ON RENTALHISTORY
BEGIN
dbms_output.put_line( 'Records can not be deleted');
END;
DELETE FROM RENTALHISTORY WHERE RENTALID = 1;
-- It is deleting before it says it can not delete
1 rows deleted.
Records can not be deleted
【问题讨论】:
-
添加到触发器正文中:
raise_application_error(-20001,'Records can not be deleted'); -
看到这个已经回答了:stackoverflow.com/a/16449271/460557