From: Josh Berkus <josh@agliodbs.com>
To: qradius@qnet.com.pe, "pgsql-sql@postgresql.org" <pgsql-sql@postgresql.org>
Subject: Re: help with function and quotes
Date: Thu, 08 Nov 2001 08:44:05 -0800
Message-ID: <web-501645@davinci.ethosmedia.com> (raw)
In-Reply-To: <200111071737.fA7HbQm14752@postgresql.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com
Subject: Re: help with function and quotes
In-Reply-To: <web-501645@davinci.ethosmedia.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox