Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: DECODE Using a Date Comparison? Any ideas?
If datesuspendstart is a date value then the expression should be:
DECODE(sign(datesuspendstart+numsuspendduration-SYSDATE),1,1,0)
Matt Brennan wrote:
> Yes - the one below should work. DECODE won't handle ranges of values
> (like using > or < operators), but you can fake it out into doing so by
> using the sign function.
> --
> Matt Brennan
> SQL*Tools Specialist
> GERS Retail Systems
> 9725-C Scranton Road
> San Diego, California 92121
> 1-800-854-2263
> mbrennan_at_gers.com
> (Original email address is spam-blocked.)
>
> Mauro <sbffn_at_vgf.vg> wrote in article <35c08fea.100941476_at_news>...
> > On Thu, 30 Jul 1998 15:14:48 GMT, mark_tortolano_at_dial.pipex.com wrote:
> >
> > -snip-
> > >What I would like to do is ...
> > >I tried a DECODE that looked like this, but it doesn't work:-
> > >DECODE(((TO_DATE(datesuspendstart+numsuspendduration))>SYSDATE),1,0,0)
> >
> > Try:
> >
> > DECODE(sign(TO_DATE(datesuspendstart+numsuspendduration)-SYSDATE),
> > 1,'greater than',
> > 0,'equal to',
> > 'less than')
> >
> > --
> > Mauro.
> >
> > (My return address is intentionally invalid; ROT13 is required.
> > As someone already told this audience, my responses are not to be
> > considered official technical support or advice.)
> >
Received on Sat Aug 01 1998 - 15:27:05 CDT