I tried this
it compiles fine but doesn't do anything when I update the patient table.Code:CREATE OR REPLACE TRIGGER AXIUM."RMVBALTRG" BEFORE UPDATE OF "LastPaymentAmount" ON "PATIENT" REFERENCING NEW AS NEW FOR EACH ROW DECLARE v_bal NUMBER(10); BEGIN update PTBAL_TMP set "Sum" = (Select sum("Sum" - :NEW."LastPaymentAmount" ) from ptbal_tmp where "Patient" = :NEW."Patient") where "Patient"= :NEW."Patient"; select "Sum" into v_bal from PTBAL_TMP where "Patient"=:NEW."Patient" ; IF (v_bal <=0) THEN update patient set "Office1"=DECODE(trim("Office1"),'BAL',' ',"Office1"), "Office2"=DECODE(trim("Office2"),'BAL',' ',"Office2"), "Office3"=DECODE(trim("Office3"),'BAL',' ',"Office3"), "Office4"=DECODE(trim("Office4"),'BAL',' ',"Office4"), "Office5"=DECODE(trim("Office5"),'BAL',' ',"Office5") where "Patient"=:NEW."Patient"; END IF; exception when others then null; END; /




Reply With Quote