error using pl/pgsql? [possibly off topic]

From: "Johnny Jørgensen" <pgsql(at)halfahead(dot)dk>
To: pgsql-general(at)postgresql(dot)org
Subject: error using pl/pgsql? [possibly off topic]
Date: 2001-11-23 11:16:31
Message-ID: 200111231216310708.00868AE2@mail.halfahead.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm not sure if this is the place to get help on specific questions, but I'll give it a go..

I have a problem with this function:

CREATE FUNCTION new_order(text,text)
RETURNS text
AS '
DECLARE
p_id ALIAS FOR $1;
p_date ALIAS FOR $2;
ret_val text;
BEGIN
BEGIN WORK;
INSERT INTO ordre (person_id,placement_date,status) VALUES (p_id::int4,p_date::decimal,1);
SELECT currval(ordre_id_seq::text) INTO ret_val;
COMMIT WORK;
RETURN ret_val;
END;
'
LANGUAGE 'plpgsql';

- I can create it, but when i run it, I get:

NOTICE: plpgsql: ERROR during compile of new_order near line 12
ERROR: parse error at or near ""

- the error message not being very informative, I've stared blindly at the script for an hour, messed with it, but i'm not really getting anywhere :/

If anyone can point me to my probably embarassingly obvious error, i'd be grateful.
Also, i'd appreciate some pointers to resources on plpgsql -i've got Momjian's book, and "Beginning databases with postgresql" (Stones, Matthew), but they each devote some 10 pages to plpgsql, and i'd love to get around a bit more?

thanks,
Johnny Jørgensen

johnny(at)halfahead(dot)dk
+45 6315 7328

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nikola Milutinovic 2001-11-23 12:43:15 TEXT datatype: compared to CHAR and VARCHAR
Previous Message Gabriel Fernandez 2001-11-23 10:50:03 Is the list working ok ?