help with function and quotes

From: qradius(at)qnet(dot)com(dot)pe
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: help with function and quotes
Date: 2001-11-07 17:37:16
Message-ID: 200111071737.fA7HbQm14752@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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';

I know probably this doesn't works, justly I have doubts
about how to implement this since I want the funtion takes
the variable additional , not the string 'additional', What I
should to consider? I read the documentation on pqsql
language aboute using quotes but none case is resemblance to
my case.

Can someone tell me an orientation about this?

Thank you in advance.

Ernesto

---------------------------------------------
Este mensaje fue enviado a travs de Qnet
http://www.qnet.com.pe

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-11-07 17:38:43 Re: RIGHT JOIN is only supported with mergejoinable join conditions
Previous Message Stephan Szabo 2001-11-07 17:14:19 Re: Need help with embedded CASEs