Re: DECODE
From: N.Prabhakar <prabhs_at_pacific.net.sg>
Date: 1996/12/06
Message-ID: <588ej1$ra3_at_newton.pacific.net.sg>#1/1
Date: 1996/12/06
Message-ID: <588ej1$ra3_at_newton.pacific.net.sg>#1/1
Les Sprott <les.e.sprott_at_tgpl.twc.com> writes: > I am trying to use the following logic in a DECODE statement:
>
> if the ((abs(x/y))-1) > .02 then 'Y' elses 'N'.
>
> any help would be greatly appreciated.
>
> Les Sprott
> Transco Energy
Hi there,
Try the following
select decode( sign (abs(x/y) -1) - 0.2) ,0,'Y',1,'Y','N') from dual.
I tested the example with two cases.
x = 9, y = 10
x = -9 y = 10
I think it works. Please let me know after your exhaustive testing.
Regards
N.Prabhakar Received on Fri Dec 06 1996 - 00:00:00 CET