Re: Decode function

From: Jurij Modic <jmodic_at_src.si>
Date: Mon, 25 Oct 1999 23:34:58 GMT
Message-ID: <3815e54b.5859580_at_news.siol.net>


On Mon, 25 Oct 1999 20:19:58 GMT, "Lars Sjöström" <lasse.sjostrom_at_telia.com> wrote:

>I dont think you can do that, without using one value for each value in of
>ITEM_TYPE.
>
>I am trying to work something out and map values between 60 to 64 on 0 (not
>inside) and 1 (inside) but I cant think of any. Someone else might do
>that...if one succed it would be a great number of DECODES...
>
>You can not solve it using GREATEST and LOWEST? Maybe those are not allowed
>in WHERE-clauses.

Use the SIGN function:

SELECT DECODE(1, SIGN(60-x), 0, SIGN(x-64), 0, 1) FROM dual;

will return 1 for any x value between 60 and 64 and 0 for any value outside this range.

>Lars

HTH, Jurij Modic <jmodic_at_src.si>
Certified Oracle DBA (7.3 & 8.0 OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Tue Oct 26 1999 - 01:34:58 CEST

Original text of this message