pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Kumar <sgnerd@yahoo.com.sg>
Cc: psql <pgsql-sql@postgresql.org>
Subject: Re: Dynamic Query for System functions - now()
Date: Mon, 10 Nov 2003 07:30:26 -0800 (PST)
Message-ID: <20031110072842.K16647@megazone.bigpanda.com> (raw)
In-Reply-To: <017701c3a75a$0e3e6050$7502a8c0@hdsc.com>
References: <017701c3a75a$0e3e6050$7502a8c0@hdsc.com>

On Mon, 10 Nov 2003, Kumar wrote:

> select now()+ interval'1 month';  -- This is working fine.
>
> I wanna dynamically assign the interval number. i,e --> select now()+
> interval'n month';

If n is an integer, I'd suggest something like
 select now() + n * interval '1 month';
rather than messing around with the text of the interval literal.




view thread (8+ messages)  latest in thread

Message-ID: <20031110072842.K16647@megazone.bigpanda.com>
Permalink:  ../20031110072842.K16647@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20031110072842.K16647@megazone.bigpanda.com

 · 

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: sszabo@megazone.bigpanda.com, sgnerd@yahoo.com.sg
  Subject: Re: Dynamic Query for System functions - now()
  In-Reply-To: <20031110072842.K16647@megazone.bigpanda.com>

* 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