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 7B7E15295C for ; Tue, 9 Aug 2005 19:31:57 -0300 (ADT) 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 83722-09 for ; Tue, 9 Aug 2005 22:31:52 +0000 (GMT) Received: from titan.open-networks.net (ns.open-networks.net [202.173.176.254]) by svr1.postgresql.org (Postfix) with ESMTP id E32D25298A for ; Tue, 9 Aug 2005 19:31:50 -0300 (ADT) Received: from [192.168.1.200] (tim.open-networks.net [192.168.1.1]) by titan.open-networks.net (Postfix) with ESMTP id 76868DA3 for ; Wed, 10 Aug 2005 08:31:50 +1000 (EST) Message-ID: <42F92ED6.4010207@open-networks.net> Date: Wed, 10 Aug 2005 08:31:50 +1000 From: Timothy Smith User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050721) X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: pgsql-sql@postgresql.org Subject: unsubscribe References: <42363BD1.6090405@open-networks.net> In-Reply-To: <42363BD1.6090405@open-networks.net> 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.373 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200508/41 X-Sequence-Number: 22269 Timothy Smith wrote: > 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; > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > >