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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Perform Arithmetic On Case Statement Decisions

Re: Perform Arithmetic On Case Statement Decisions

From: Ed Prochak <edprochak_at_gmail.com>
Date: 21 Feb 2007 13:10:21 -0800
Message-ID: <1172092209.956185.150120@a75g2000cwd.googlegroups.com>


On Feb 21, 4:00 pm, "jim" <jimmorga..._at_gmail.com> wrote:
> Thanks, Ed. So what would this look like inline? I'm an Oracle
> novice, so elementary advice is appreciated.
>
> Thanks again.

select name, after_numeric - before_numeric from (

     select name,
     case when before = 'x' then 1
       when before = 'y' then 2
                 else 3
       end as before_numeric,
     case when after = 'x' then 1
       when after = 'y' then 2
                 else 3
       end as after_numeric
     from table  )

;

Try that. It is an in-line view.

You really should read the manuals. I'll leave the other two options for an exercise. They really aren't much harder that the above. (HINTS: look up CREATE VIEW and CREATE FUNCTION for the second anfd third option respectively)

Have a good read.
  Ed Received on Wed Feb 21 2007 - 15:10:21 CST

Original text of this message

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