Received: from digitalplanit.wdi.co.uk (root@[195.13.87.250]) by hub.org (8.10.1/8.10.1) with ESMTP id e7IHURm55741 for ; Fri, 18 Aug 2000 13:30:28 -0400 (EDT) Received: from Graham (th-access2-85.gw.cerbernet.net [195.13.86.213]) by digitalplanit.wdi.co.uk (8.9.3/8.9.3) with SMTP id SAA19834 for ; Fri, 18 Aug 2000 18:34:37 GMT From: "Graham Vickrage" To: Subject: RE: sequences in functions Date: Fri, 18 Aug 2000 18:28:34 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <638911580.20000818200711@vpcit.ru> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Importance: Normal X-Archive-Number: 200008/181 I have noticed that you can only pass 16 parameters to a function, I was therefore wondering how you can do atomic inserts (such as the function below but with more params) using pl/pgsql if you can't pass complex data types. Is this something that transactions are not used for or is it best done as two seperate calls in my perl scripts? -----Original Message----- From: pgsql-sql-owner@hub.org [mailto:pgsql-sql-owner@hub.org]On Behalf Of Yury Don Sent: 18 August 2000 15:07 To: pgsql-sql@postgresql.org Subject: Re: [SQL] sequences in functions Hello Graham, Friday, August 18, 2000, 6:24:15 PM, you wrote: GV> I am having problems referencing sequeces in a function, I think because of GV> the '' characters. The function I am creating is a follows: - GV> CREATE FUNCTION InsertClient ( varchar, varchar, varchar, varchar, varchar, GV> varchar ) RETURNS int4 AS ' GV> DECLARE GV> id INT; GV> BEGIN GV> SELECT nextval('client_seq') INTO id; GV> INSERT INTO client (client_id, last_name, address1, country) GV> VALUES (id, $1, $2, $3); GV> INSERT INTO client_card (client_card_id, type, number, expiry_date, GV> client_id) GV> VALUES (nextval('client_card_seq'), $4, $5, $6, id); GV> RETURN id; GV> END; GV> ' LANGUAGE 'plpgsql'; GV> And the error message is GV> ERROR: parser: parse error at or near "client_seq" GV> EOF GV> Is this because of the ' ' ??? You must to use two quotes: SELECT nextval(''client_seq'') INTO id; -- Best regards, Yury mailto:yura@vpcit.ru