CREATE OR REPLACE FUNCTION obsup_test_trg() RETURNS TRIGGER AS $BODY$ DECLARE DECLARE v_IsEmployee CHAR(1); BEGIN IF AD_isTriggerEnabled()='N' THEN IF TG_OP = 'DELETE' THEN RETURN OLD; ELSE RETURN NEW; END IF; END IF; SELECT C_TAX_ID INTO NEW.C_TAX_ID FROM C_TAX WHERE C_TAX_ID= '84326B11441C493E841DDC090197A261'; IF TG_OP = 'DELETE' THEN RETURN OLD; ELSE RETURN NEW; END IF; END; $BODY$ LANGUAGE plpgsql; CREATE TRIGGER obsup_test_trg BEFORE INSERT OR UPDATE ON c_invoiceline FOR EACH ROW EXECUTE PROCEDURE obsup_test_trg();