只能在工作时间内更新某表
程序员文章站
2022-07-25 21:57:40
例如规定只能在工作时间内更新Student表,可以定义如下触发器,其中sysdate为系统当前时间 CREATE OR REPLACE TRIGGER secure_student BEFORE INSERT OR UPDATE OR DELETE ON studentBEGIN IF (TO_CH ......
例如规定只能在工作时间内更新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;
推荐阅读