Thanks for the reply. I am not sure if this is what you mean but this is what I went with and it seems to be doing the trick..
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) and :NEW."Office1"='BAL' THEN :New."Office1" := ' '; elsif (v_bal <=0) and :NEW."Office2"='BAL' THEN :New."Office2" := ' '; elsif (v_bal <=0) and :NEW."Office3"='BAL' THEN :New."Office3" := ' '; elsif (v_bal <=0) and :NEW."Office4"='BAL' THEN :New."Office4" := ' '; elsif (v_bal <=0) and :NEW."Office5"='BAL' THEN :New."Office5" := ' '; END IF; exception when others then null; END; /




Reply With Quote