只能在工作时间内更新某表
程序员文章站
2022-04-24 10:36:06
例如规定只能在工作时间内更新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;
上一篇: 关于赞扬雷锋的诗歌
下一篇: Java 读取控制台输入
推荐阅读