RE: Decode function

  • From: "SHEEHAN, JEREMY" <Jeremy.Sheehan@xxxxxxx>
  • To: "Krish Hariharan (gmail)" <krishh.personal@xxxxxxxxx>
  • Date: Thu, 30 Jul 2009 08:13:12 -0400

Someone else mentioned the CASE function in an off list email.  It actually 
worked best for my purpose.

Thanks to all!

Jeremy
 Consider the environment. Please don't print this e-mail unless you really 
need to.

-----Original Message-----
From: Krish Hariharan (gmail) [mailto:krishh.personal@xxxxxxxxx] 
Sent: 29 July, 2009 10:23 PM
To: SHEEHAN, JEREMY
Cc: Bellows, Bambi (Comsys); Oracle L
Subject: Re: Decode function

SHEEHAN, JEREMY wrote:
>
> That solves my problem! Thanks!!
>
> Jeremy
>
> P *Consider the environment. Please don't print this e-mail unless you 
> really need to.*
>
> *From:* Bellows, Bambi (Comsys) [mailto:bbel5@xxxxxxxxxxxx]
> *Sent:* 29 July, 2009 4:34 PM
> *To:* SHEEHAN, JEREMY; Oracle L
> *Subject:* RE: Decode function
>
> Not as such, but I do this all the time by use of the sign function.
>
> For example, if you want to return X if val> 100, Y if it’s less, and 
> Z if it’s equal , you can do:
>
> select decode(sign(val-100),-1,’X’,1,’Y’,0,’Z’,’error’) from dual;
>
> ------------------------------------------------------------------------
>
> *From:* oracle-l-bounce@xxxxxxxxxxxxx 
> [mailto:oracle-l-bounce@xxxxxxxxxxxxx] *On Behalf Of *SHEEHAN, JEREMY
> *Sent:* Wednesday, July 29, 2009 3:29 PM
> *To:* Oracle L
> *Subject:* Decode function
>
> I think the answer is no, but can you set greater than, less than 
> conditions in a decode function?
>
> TIA!!
>
> Jeremy
>
> P *Consider the environment. Please don't print this e-mail unless you 
> really need to.*
>
another construct is the case statement which is quite versatile (not 
entirely sure which version it was introduced, but I use it fairly often 
in 10g


Other related posts: