Trigger created with error [message #319090] |
Fri, 09 May 2008 00:43  |
aslamsadia
Messages: 19 Registered: December 2006
|
Junior Member |
|
|
I have coded a trigger for updation of BALANCE column in BILL_MR table, but trigger created with compilation error. Code is :-
CREATE OR REPLACE TRIGGER UPD_BILL_AMT
AFTER UPDATE OF BILL_AMT ON BILL_MR
FOR EACH ROW
DECLARE
PLUS_DIFF NUMBER(12,2);
MINUS_DIFF NUMBER(12,2);
BEGIN
IF UPDATING THEN
IF :NEW.BILL_AMT > :OLD.BILL_AMT THEN
PLUS_DIFF := :NEW.BILL_AMT - :OLD.BILL_AMT;
UPDATE BILL_MR SET BALANCE = BALANCE + PLUS_DIFF;
END IF;
IF :NEW.BILL_AMT < :OLD.BILL_AMT THEN
MINUS_DIFF := :OLD.BILL_AMT - :NEW.BILL_AMT;
UPDATE BILL_MR SET BALANCE = BALANCE _ MINUS_DIFF;
END IF;
END IF;
END;
The error is :-
LINE/COL ERROR
-------- -------------------------------------
12/4 PL/SQL: SQL Statement ignored
12/41 PL/SQL: ORA-00911: invalid character
Pls help.
|
|
|
|
Re: Trigger created with error [message #319138 is a reply to message #319090] |
Fri, 09 May 2008 02:32  |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Can you not replace this whole piece of code with:CREATE OR REPLACE TRIGGER UPD_BILL_AMT
AFTER UPDATE OF BILL_AMT ON BILL_MR
FOR EACH ROW
BEGIN
:new.BALANCE := :new.BALANCE + :new.BILL_AMT - :old.BILL_AMT;
END;
|
|
|