觸發(fā)器沒有效果
create or replace trigger securityemp before insert on emp begin ?if to_char(sysdate,'day') in ('星期六','星期天') or ? ?to_number(to_char(sysdate,'hh24')) not between 9 and 18 then ? ?--禁止insert新員工 ? ?raise_application_error(-20001,'禁止在非工作時間插入新員工'); end if; end; 為什么我用PL/SQL工具編寫觸發(fā)器后,插入語句沒有任何效果呢?
2021-06-22
create or replace trigger no_time_newdate before insert on unifier_uxqa0401
begin
? if to_char(sysdate,'day') in('saturday','sunday') or to_number(to_char(sysdate,'hh24')) not between 9 and 18
??? --禁止insert
??? raise_application_error(-20001,'非工作時間禁止寫入');
??? end if;
end ;
我是這樣寫的,親測有效