From: | "Graham Vickrage" <graham(at)digitalplanit(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | sequences in functions |
Date: | 2000-08-18 12:24:15 |
Message-ID: | NDBBJABDILOPAOOMFJHOMEPNCDAA.graham@digitalplanit.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I am having problems referencing sequeces in a function, I think because of
the '' characters. The function I am creating is a follows: -
CREATE FUNCTION InsertClient ( varchar, varchar, varchar, varchar, varchar,
varchar ) RETURNS int4 AS '
DECLARE
id INT;
BEGIN
SELECT nextval('client_seq') INTO id;
INSERT INTO client (client_id, last_name, address1, country)
VALUES (id, $1, $2, $3);
INSERT INTO client_card (client_card_id, type, number, expiry_date,
client_id)
VALUES (nextval('client_card_seq'), $4, $5, $6, id);
RETURN id;
END;
' LANGUAGE 'plpgsql';
And the error message is
ERROR: parser: parse error at or near "client_seq"
EOF
Is this because of the ' ' ???
Also can you pass in a array or hash to the function?
Cheers
Graham
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Lockhart | 2000-08-18 13:44:34 | Re: [HACKERS] [Fwd: Optimization in C] |
Previous Message | Joerg Hessdoerfer | 2000-08-18 11:21:21 | Re: Continuous inserts... |