Received: from redbox.venux.net (redbox.venux.net [216.47.238.10]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA85514 for ; Tue, 4 Jan 2000 10:01:25 -0500 (EST) (envelope-from mitch@venux.net) Received: from inky (inky.venux.net [216.47.238.64]) by redbox.venux.net (Postfix) with SMTP id E8B442E20B for ; Tue, 4 Jan 2000 09:54:34 -0500 (EST) Message-ID: <00cc01bf56c5$03cd5e80$40ee2fd8@venux.net> From: "Mitch Vincent" To: References: <21582.943985242@sss.pgh.pa.us> Subject: Triggers Date: Tue, 4 Jan 2000 10:04:35 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 I'm using this funtion via a trigger to total up amounts in several fields (and adding that value into a total field).. CREATE FUNCTION invoice_total_trigger() RETURNS OPAQUE AS ' BEGIN NEW.total := NEW.fee_membership + NEW.fee_logins + NEW.fee_convention + NEW.fee_prints+ NEW.fee_hotlines + NEW.fee_postage + NEW.fee_ups + NEW.fee_late + NEW.fee_other1 + NEW.fee_other2 + NEW.fee_other3 + NEW.fee_pastdue; RETURN NEW; END; ' LANGUAGE 'plpgsql'; That's the function, here is the trigger. CREATE TRIGGER invoice_total_trigger AFTER INSERT OR UPDATE ON invoice FOR EACH ROW EXECUTE PROCEDURE invoice_total_trigger(); It works for updating but not when you insert a new row. Am I doing it wrong? I need the invoice_total_trigger to run every time a row is updated or inserted.. Thanks guys! -Mitch