Received: from digitalplanit.wdi.co.uk ([195.13.87.250]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eAEDcjs37825 for ; Tue, 14 Nov 2000 08:38:46 -0500 (EST) (envelope-from graham@digitalplanit.com) Received: from Graham (dp0002.demon.co.uk [193.237.187.164]) by digitalplanit.wdi.co.uk (8.9.3/8.9.3) with SMTP id NAA09478 for ; Tue, 14 Nov 2000 13:44:07 GMT From: "Graham Vickrage" To: Subject: Trigger cant find function Date: Tue, 14 Nov 2000 13:36:15 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-Archive-Number: 200011/107 X-Sequence-Number: 138 I seem to be having difficulty creating a trigger. I have creted the function and tested it which seems to work fine: - CREATE FUNCTION get_prod_cost_price (varchar, int8) RETURNS float AS ' DECLARE cost FLOAT; BEGIN SELECT cost_price INTO cost FROM product WHERE code = $1; IF FOUND THEN UPDATE order_detail SET cost_price = cost WHERE order_detail_id=$2; RETURN cost; END IF; RETURN 0; END; ' LANGUAGE 'plpgsql'; dvd=> select get_prod_cost_price ('DVD368', 10027); get_prod_cost_price ------------------- 9.81 (1 row) Now I try and create the approprate trigger and I get the following:- CREATE TRIGGER tg_update_order_detail AFTER insert ON order_detail FOR EACH ROW EXECUTE PROCEDURE get_prod_cost_price('product_id', 'order_detail_id'); ERROR: CreateTrigger: function get_prod_cost_price() does not exist It is clear that it does exist so why does the trigger creation code not find it? Thanks in advance for any pointers. Graham