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

Reply via email to