if you are using trigger to generate sequence then might happened that the trigger is called twice. So to prevent from increasing the id value here is a little trick
CREATE OR REPLACE TRIGGER TRG_ABC BEFORE INSERT ON ABC
FOR EACH ROW
BEGIN
if :NEW.ID is null
then SELECT ABC_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
end if;
END;
No comments:
Post a Comment