Path: news.easynews.com!easynews!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sunqbc.risq.qc.ca!carnaval.risq.qc.ca.POSTED!not-for-mail
From: Mark Styles <news@lambic.co.uk>
Newsgroups: comp.databases.oracle.misc
Subject: Re: Decode Statement
Organization: Lambic Computer Consultants Inc
Message-ID: <9l89stg58ei7jsjle75mfbbvv29cmrsnha@4ax.com>
References: <248587ca.0110101101.3bf63714@posting.google.com>
X-Newsreader: Forte Agent 1.8/32.553
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 23
Date: Wed, 10 Oct 2001 19:36:13 GMT
NNTP-Posting-Host: 132.206.16.201
X-Complaints-To: abuse@mcgill.ca
X-Trace: carnaval.risq.qc.ca 1002742573 132.206.16.201 (Wed, 10 Oct 2001 15:36:13 EDT)
NNTP-Posting-Date: Wed, 10 Oct 2001 15:36:13 EDT
Xref: easynews comp.databases.oracle.misc:70145
X-Received-Date: Wed, 10 Oct 2001 12:36:01 MST (news.easynews.com)

On 10 Oct 2001 12:01:44 -0700, dennishancy@eaton.com (Dennis Hancy)
wrote:

>A typical Decode statement looks like this..
>
>decode(value, if1, then1, if2, then2...)
>
>
>Can the "if" values be replaced with a range?  For instance, what if
>you wanted to check if "value" is between 1 and 10.
>
>Could you do this...
>
>decode(value, between 1 and 10, then1, if2, then2...)   ?

For A between B and C:

DECODE( SIGN(a-b),  
                            1, DECODE( SIGN(a - c),  
                                       -1, TRUE,  
                                       FALSE ),  
                            FALSE)

