X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C88B8D1B50C for ; Mon, 10 Nov 2003 07:15:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 40915-08 for ; Mon, 10 Nov 2003 03:15:20 -0400 (AST) Received: from smtp005.mail.ukl.yahoo.com (smtp005.mail.ukl.yahoo.com [217.12.11.36]) by svr1.postgresql.org (Postfix) with SMTP id 2027CD1B4EF for ; Mon, 10 Nov 2003 03:15:18 -0400 (AST) Received: from unknown (HELO IVESIA67) (sgnerd@203.196.190.138 with login) by smtp1.mail.vip.ukl.yahoo.com with SMTP; 10 Nov 2003 07:15:17 -0000 Message-ID: <017701c3a75a$0e3e6050$7502a8c0@hdsc.com> Reply-To: "Kumar" From: "Kumar" To: "psql" Subject: Dynamic Query for System functions - now() Date: Mon, 10 Nov 2003 12:42:47 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0174_01C3A788.24FBABD0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=HTML_40_50 X-Spam-Level: X-Archive-Number: 200311/79 X-Sequence-Number: 15894 This is a multi-part message in MIME format. ------=_NextPart_000_0174_01C3A788.24FBABD0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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()+ inter= val'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 functio= n. Regards Kumar ------=_NextPart_000_0174_01C3A788.24FBABD0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear Friends,
 
I am using PostgreSQL 7.3.4 Server on RH Linux 7.2. I a= m=20 trying to generate a dynamic query to fetch the next month=20 interval.
 
select now()+ interval'1 month';  -- This is worki= ng=20 fine.
 
I wanna dynamically assign the interval number. i,e --&= gt;=20 select now()+ interval'n month';
 
For this I wanted to write a dynamic query.
EXECUTE 'select now()+ interval\'' || 3||=20 'month\'';
Error
    ERROR:  parser: parse error at = or near=20 "'select now()+ interval\''" at character 9
 
Help help me with this. I wanted to use this query insi= de a=20 PLpgSQL function.
 
Regards
Kumar

------=_NextPart_000_0174_01C3A788.24FBABD0--