From: Timothy Smith <timothy@open-networks.net>
To: pgsql-sql@postgresql.org
Subject: postgresql 8.01, plpgsql
Date: Tue, 15 Mar 2005 11:35:13 +1000
Message-ID: <42363BD1.6090405@open-networks.net> (raw)
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;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: timothy@open-networks.net
Subject: Re: postgresql 8.01, plpgsql
In-Reply-To: <42363BD1.6090405@open-networks.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox