例如規定只能在工作時間內更新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;