Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fA8Gi2m08193 for ; Thu, 8 Nov 2001 11:44:02 -0500 (EST) (envelope-from josh@agliodbs.com) Received: from [209.10.40.250] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.4.7) with HTTP id 501645; Thu, 08 Nov 2001 08:44:05 -0800 From: "Josh Berkus" Subject: Re: help with function and quotes To: qradius@qnet.com.pe, "pgsql-sql@postgresql.org" X-Mailer: CommuniGate Pro Web Mailer v.3.4.7 Date: Thu, 08 Nov 2001 08:44:05 -0800 Message-ID: In-Reply-To: <200111071737.fA7HbQm14752@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Archive-Number: 200111/132 X-Sequence-Number: 5516 Ernesto, > CREATE FUNCTION addtime(integer) RETURNS INTEGER AS ' > DECLARE > additional ALIAS FOR $1; > BEGIN > update mytable set mytime=now()+''additional seconds''; > END; > ' > return 1; > LANGUAGE 'plpgsql'; Please go to techdocs (http://techdocs.postgresql.org/) and read Roberto Mello's revised PL/pgSQL documentation (Roberto, is this part of the main docs, yet?). There's several mistakes in this simple procedure, in addition to the one you asked about. Or you could read the first 2-3 chapters of any book on PL/SQL for Oracle. Then, try this: CREATE FUNCTION addtime(integer) RETURNS INTEGER AS ' DECLARE additional ALIAS FOR $1; BEGIN update mytable set mytime=now()+ INTERVAL( to_char(additional, ''9999'') || '' seconds''); RETURN additional; END;' LANGUAGE 'plpgsql'; -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco