create or replace trigger securityemp
before insert
on emp
declare
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;
/
before insert
on emp
declare
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;
/
2018-06-19
当oracle数据库在原表中 插入时在触发器中要
declare;
PRAGMA AUTONOMOUS_TRANSACTION;
commit
declare;
PRAGMA AUTONOMOUS_TRANSACTION;
commit
2018-03-12