From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | qradius(at)qnet(dot)com(dot)pe, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: help with function and quotes |
Date: | 2001-11-08 16:44:05 |
Message-ID: | web-501645@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-11-08 16:49:28 | Re: Can this query be optimized? |
Previous Message | Stephan Szabo | 2001-11-08 16:37:55 | Re: help with sintaxis of quotes on function |