sequences in functions

Поиск
Список
Период
Сортировка
От Graham Vickrage
Тема sequences in functions
Дата
Msg-id NDBBJABDILOPAOOMFJHOMEPNCDAA.graham@digitalplanit.com
обсуждение исходный текст
Ответы Re: sequences in functions
Список 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 '
DECLAREid INT;
BEGINSELECT 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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Joerg Hessdoerfer
Дата:
Сообщение: Re: Continuous inserts...
Следующее
От: Yury Don
Дата:
Сообщение: Re: sequences in functions