例如规定只能在工作时间内更新student表,可以定义如下触发器,其中sysdate为系统当前时间
create or replace trigger secure_student
before insert or update or delete
on student
begin
if (to_char (sysdate, ‘dy’) in (‘sat’, ‘sun’))
or (to_number (sysdate, ‘hh24’) not between 8 and 17)
then
raise_application_error
(-20506,
‘you may only change data during normal business hours.’
);
end if;
end;