First page Back Continue Last page Graphics

Trigger-Assigned Primary Key from the Database Sequence


Notes:

Trigger-Assigned Primary Key from the Database Sequence

create or replace

TRIGGER ASSIGN_SUPPLIER_ID BEFORE INSERT ON SUPPLIERS

FOR EACH ROW

BEGIN

IF :NEW.SUPPLIER_ID IS NULL OR :NEW.SUPPLIER_ID < 0 THEN

SELECT SUPPLIER_SEQ.NEXTVAL

INTO :NEW.SUPPLIER_ID

FROM DUAL;

END IF;

END;