A script-enabled browser is required for this page to function properly.

Creating a Database Trigger

To create a database trigger:

  1. In the Object Navigator, expand the Database Objects node to display the Schema nodes.
  2. Expand a Schema node to display the database objects.
  3. Expand the Tables node to display the Schema's database tables.
  4. Select and expand the desired table.
  5. Select the Triggers node and choose Edit | Create.
    The Database Trigger Editor appears.
  6. In the Database Trigger Editor, define and save the desired program units.

Creating a database trigger Examples

CREATE TRIGGER no_weekend_updates

BEFORE UPDATE
ON EMP
DECLARE
day_of_week NUMBER(2) := TO_NUMBER(TO_CHAR(SYSDATE,'D'));
dummy CHAR(1);
BEGIN
IF (day_of_week in (1,7)) /* Sunday,Saturday */
THEN
BEGIN
SELECT 'X'/* Check Exceptions Table */
INTO dummy
FROM WEEKEND_UPDATE_OK
WHERE USERID = USER;
EXCEPTION
WHEN NO_DATA_FOUND THEN /*Not Exception*/
RAISE_APPLICATION_ERROR(-20011,
'Try again on Monday!');
END;
END IF;
END;


About database triggers

Modifying a database trigger