Dynamic Query for System functions - now() - Mailing list pgsql-sql

From Kumar
Subject Dynamic Query for System functions - now()
Date
Msg-id 017701c3a75a$0e3e6050$7502a8c0@hdsc.com
Whole thread Raw
Responses Re: Dynamic Query for System functions - now()  (Christoph Haller <ch@rodos.fzk.de>)
Re: Dynamic Query for System functions - now()  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: Dynamic Query for System functions - now()  (Gaetano Mendola <mendola@bigfoot.com>)
List pgsql-sql
Dear Friends,
 
I am using PostgreSQL 7.3.4 Server on RH Linux 7.2. I am trying to generate a dynamic query to fetch the next month interval.
 
select now()+ interval'1 month';  -- This is working fine.
 
I wanna dynamically assign the interval number. i,e --> select now()+ interval'n month';
 
For this I wanted to write a dynamic query.
EXECUTE 'select now()+ interval\'' || 3|| 'month\'';
Error
    ERROR:  parser: parse error at or near "'select now()+ interval\''" at character 9
 
Help help me with this. I wanted to use this query inside a PLpgSQL function.
 
Regards
Kumar

pgsql-sql by date:

Previous
From: Christopher Browne
Date:
Subject: Re: help me...
Next
From: Christoph Haller
Date:
Subject: Re: Dynamic Query for System functions - now()