Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Help with DECODE

Re: Help with DECODE

From: Eric Junkermann <eric_at_deptj.demon.co.uk>
Date: Sat, 02 May 1998 18:20:16 GMT
Message-ID: <354b50a1.34593182@news.demon.co.uk>


On Wed, 29 Apr 1998 11:41:31 GMT, tim.hall_at_spam.begone (Tim Hall) wrote:

>
>Decode (A,B,C,D) means IF A=B THEN C ELSE D. In other words, it only
>compares equality, not ranges.
>
>What you need to do in circumstances like this is use the GREATEST and
>LEAST functions in the decode:
>
>DECODE(LEAST(magnitude,5.5),5.5,'Very Faint','Faint')
>
>This will return the string 'Faint' in magnitude is less than 5.5
>
>

But since two boundary points are needed, you will have to say  

DECODE(LEAST(magnitude,8.4),8.4,'Very Faint',

      DECODE(LEAST(magnitude,5.5),5.5,'Faint','Visible'))

which means (this is just pseudo-code)

	IF 8.4 <= magnitude
		'Very Faint'
	ELSE
		IF 5.5 <= magnitude
			'Faint'
		ELSE
			'Visible'
		ENDIF
	ENDIF

You can go on nesting like this for as many layers as you want, but it gets hard to read!

Eric Received on Sat May 02 1998 - 13:20:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US