Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Trigger Question
Please help
Using Oracle 8.0.5.2
I am duplicating an existing trigger in another table but the exact same code does not work in this new table.
This is the body of the trigger for table prev_loans on column ID. I am creating an auto increment field.
Any assistance would be greatly appreciated.
DECLARE
iCounter PREV_LOANS.ID%TYPE;
cannot_change_counter EXCEPTION;
BEGIN
IF INSERTING THEN
Select SEQ_PREV_LOANS.NEXTVAL INTO iCounter FROM Dual; :new.ID := iCounter;
IF NOT (:new.ID = :old.ID) THEN RAISE cannot_change_counter; END IF;
WHEN cannot_change_counter THEN raise_application_error(-20000, 'Cannot Change Counter Value');END; Mike
![]() |
![]() |