Oracle Sequence Triggers

The RazorSQL alter table tool includes an Add Sequence Trigger option for adding a sequence trigger to an Oracle database table. The add sequence trigger option has a dropdown with the sequences defined in the database. After the user selects a sequence, the user can enter a trigger name and a sequence column, and RazorSQL will generate the SQL to create the sequence trigger on the table.

Listed below is an example of the SQL generated by the Oracle Add Sequence Trigger function:

CREATE OR REPLACE TRIGGER TEST_SEQ_TRIGGER BEFORE INSERT ON TESTUSER.EMPLOYEE FOR EACH ROW BEGIN IF :new.SSN IS NULL THEN SELECT TEST_SEQUENCE.nextval INTO :new.SSN FROM DUAL; END IF; END;

Below is a screen shot of the add sequence trigger function of the Oracle alter table tool.

Oracle Add Sequence Trigger