X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 952DE566FC for ; Tue, 15 Mar 2005 01:35:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32814-07 for ; Tue, 15 Mar 2005 01:35:20 +0000 (GMT) Received: from titan.open-networks.net (dsl-202-173-176-254.qld.westnet.com.au [202.173.176.254]) by svr1.postgresql.org (Postfix) with ESMTP id 8018D563EE for ; Tue, 15 Mar 2005 01:35:17 +0000 (GMT) Received: from [192.168.1.200] (unknown [192.168.1.1]) by titan.open-networks.net (Postfix) with ESMTP id 2300CA35 for ; Tue, 15 Mar 2005 11:35:14 +1000 (EST) Message-ID: <42363BD1.6090405@open-networks.net> Date: Tue, 15 Mar 2005 11:35:13 +1000 From: Timothy Smith User-Agent: Mozilla Thunderbird 0.8 (X11/20041023) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: postgresql 8.01, plpgsql Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.886 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, UPPERCASE_25_50, URIBL_SBL X-Spam-Level: X-Archive-Number: 200503/203 X-Sequence-Number: 20682 i have the following function in plpgsql giving stynax errors all over the place. i have doen createlang on the db, as far as i can see i'm right. is there anything obviously wrong? one thing to note is i followed this example http://www.zigo.dhs.org/postgresql/#insert_or_update and it gives the same errors. "ERROR: unterminated dollar-quoted string at or near "$$ BEGIN LOOP" CREATE OR REPLACE FUNCTION insert_update_daily_takings (ID BIGINT, TillName VARCHAR, Tape NUMERIC(10,2), Cash NUMERIC(10,2), GM NUMERIC(10,2), VenueManager NUMERIC(10,2), AsstManager NUMERIC(10,2), BarManager NUMERIC(10,2), PRCards NUMERIC(10,2), otherPromo NUMERIC(10,2), Functions NUMERIC(10,2), Accounts NUMERIC(10,2), Spill NUMERIC(10,2), Orings NUMERIC(10,2), Variance NUMERIC(10,2) ) RETURNS VOID AS $$ BEGIN LOOP UPDATE daily_takings SET till_name = TillName, tape = Tape, cash = Cash, promo_manager = GM, venue_manager = VenueManager, asst_manager = AsstManager, bar_manager = BarManager, pr_cards = PRCards, other_promo = otherPromo, functions = Functions, accounts = Accounts, spill = Spill, o_rings = Orings, variance = Variance WHERE id = ID AND till_name = TillName; IF found THEN RETURN; END IF; BEGIN INSERT INTO daily_takings (id, till_name, tape, cash, promo_manager, venue_manager, asst_manager, bar_manager, pr_cards, other_promo, functions, accounts, spill, o_rings, variance) VALUES (ID, TillName, Tape, Cash, GM, VenueManager, AsstManager, BarManager, PRCards, otherPromo, Functions, Accounts, Spill, Orings, Variance); RETURN; EXCEPTION WHEN unique_violation THEN NULL END; END LOOP; END; $$ LANGUAGE plpgsql;