Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Trigger Question

Trigger Question

From: Michael M <mikem_at_msamail.com>
Date: 1999/10/07
Message-ID: <st6L3.51$9Vv1.2490560@news5.usenetserver.com>#1/1

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;

    END IF;     IF UPDATING THEN
        IF NOT (:new.ID = :old.ID) THEN
            RAISE cannot_change_counter;
        END IF;

    END IF; EXCEPTION
     WHEN cannot_change_counter THEN
         raise_application_error(-20000, 'Cannot Change Counter Value');
END; Mike
mikem_at_msamail.com
okana_at_msn.com Received on Thu Oct 07 1999 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US