Skip to content

Instantly share code, notes, and snippets.

@jamesantrobus
Created January 17, 2011 14:03
Show Gist options
  • Save jamesantrobus/782868 to your computer and use it in GitHub Desktop.
Save jamesantrobus/782868 to your computer and use it in GitHub Desktop.
Part of the Oracle Academy training material provided to Universities
--Part of the Oracle Academy training material provided to Universities
create or replace
TRIGGER secure_employees
BEFORE INSERT OR UPDATE OR DELETE ON employees
BEGIN
secure_dml;
END secure_employees;
create or replace
PROCEDURE secure_dml
IS
BEGIN
IF TO_CHAR (SYSDATE, 'HH24:MI') NOT BETWEEN '08:00' AND '18:00'
OR TO_CHAR (SYSDATE, 'DY') IN ('SAT', 'SUN') THEN
RAISE_APPLICATION_ERROR (-20205,
'You may only make changes during normal office hours');
END IF;
END secure_dml;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment