"Madhavi Daroor" <madhavi@zoniac.com> writes:
> I need to compare this difference with a numeric value in my WHERE clause
> like this
> WHERE
> TIMESTAMP('05-21-2003 00:00:00','mm-dd-yyyy') - TO_TIMESTAMP('04-30-200300:00:00','mm-dd-yyyy') > 30
And what is the "30" supposed to mean? Seconds, days, fortnights, ... ?
If it's a constant you'd be better off to write it as an interval
constant:
... > interval '30 days'
(or whatever unit you have in mind). If it's not constant you might
try this way:
... > 30 * interval '1 day'
since there is a float-times-interval-yielding-interval operator.
regards, tom lane