create or replace trigger preventdeleted502
before delete on d502_mzdetail
for each row
begin
if deleting then raise_application_error(-200001,'不允许删除数据!');
dbms_output.PUT_LINE('不允许删除数据!');
end if;
end;
解释说明:preventdeleted502为该触发器名称,d502_mzdetail为表名,对于表d502_mzdetail如果一有删除动作,马上提示溢出错误,同时打印错误信息,那么删除动作即刻停止!