Re: trivial decode NOT

From: Amit Srivastava <amit_at_miller.cs.uwm.edu>
Date: 1995/04/18
Message-ID: <3n0an8$f3d_at_uwm.edu>#1/1


In article <3muag3$nkj_at_cardinal.fs.com> skannan_at_PROBLEM_WITH_INEWS_GATEWAY_FILE ( S. Kannan) writes:
>Mark W. Aurit (maurit_at_world.nad.northrop.com) wrote:
>: Im creating a view, and need to add a new column "Acct_Desc".
>: The pseudo code behind the new column is (roughly)
 

>: if acct ge '120' and acct le '140' then 'Labor'
>: if acct ge '150' and acct le '160 or
>: acct ge '170' and acct le '180' then 'Fringe'
>: .. and on and on, but you get the idea
 

>: Would greatly appreciate any help on how to do this in a decode
>: (unless anyone knows any other ways!)

Here is somewhat how you would go writing this decode....

select decode(sign(acct - 120),-1,'Unknown',0,'Labor',

             decode(sign(acct - 140),-1,'Labor',0,'Labor',
	     decode(sign(acct - 150),-1,'Labor',0,'Fringe',
	     decode(sign(acct - 160),-1,'Fringe',0,'Fringe',
	     decode(sign(acct - 170),-1,'Unkown',0,'Fringe',
			......)))))
	     
-- 
              _/_
 __.  ____  o /      

(_/|_/ / /_<_<__ Received on Tue Apr 18 1995 - 00:00:00 CEST

Original text of this message