只能在工作时间内更新某表
作者:互联网
例如规定只能在工作时间内更新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;
标签:SYSDATE,只能,END,secure,SUN,更新,时间,某表 来源: https://www.cnblogs.com/oracle-ziyuhou/p/10505260.html