pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: qradius@qnet.com.pe
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: help with function and quotes
Date: Wed, 7 Nov 2001 17:37:16 GMT
Message-ID: <200111071737.fA7HbQm14752@postgresql.org> (raw)

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 través de Qnet
http://www.qnet.com.pe





view thread (2+ messages)  latest in thread

Message-ID: <200111071737.fA7HbQm14752@postgresql.org>
Permalink:  ../200111071737.fA7HbQm14752@postgresql.org/
Also on:    postgresql.org/message-id/200111071737.fA7HbQm14752@postgresql.org

 · 

reply

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: qradius@qnet.com.pe
  Subject: Re: help with function and quotes
  In-Reply-To: <200111071737.fA7HbQm14752@postgresql.org>

* 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