From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Ernesto Freyre <efreyre(at)qnet(dot)com(dot)pe> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: help with sintaxis of quotes on function |
Date: | 2001-11-08 16:37:55 |
Message-ID: | 20011108083616.I53274-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Wed, 7 Nov 2001, Ernesto Freyre wrote:
> Dear Sirs:
>
> Please I am attempting implement a function that update a column to current time + X seconds
>
> So the query involved looks like:
>
> update mytable set mytime=now+'X seconds';
>
> Here X is a integer value,
>
> Now I need implement this on my function, But I have problems at
> implement this at quotes, e.g. my function could looks like:
>
> 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';
This may work as the update:
update mytable set mytime=now()+CAST((additional || '' seconds'')
AS INTERVAL);
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-11-08 16:44:05 | Re: help with function and quotes |
Previous Message | Josh Berkus | 2001-11-08 16:34:25 | Re: Increasing MAX_ARGS |