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

Home -> Community -> Usenet -> c.d.o.tools -> Re: views if and case statements

Re: views if and case statements

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 11 Jul 2001 09:50:21 -0700
Message-ID: <9ii04d01a77@drn.newsguy.com>

In article <994857820.10530.0.nnrp-02.c2de4217_at_news.demon.co.uk>, "CME" says...
>
>I am trying to convert sybase views to oracle views and I cannot find a way
>to use 'if' or 'case' statements within a view itself
>if there is any way this can be done or can be worked around please contact
>me
>thank you for any help
>
>

sigh, no version. 816 and up has case:

  1 create or replace view emp_view
  2 as

  3  select ename, empno, case when (sal < 100) then 'low'
  4                            when (sal between 101 and 500) then 'med'
  5                            when (sal between 501 and 1000) then 'high'
  6                            else 'really high'
  7                       end Salary

  8* from emp
ops$tkyte_at_ORA817.US.ORACLE.COM> /

View created.

Prior to that, decode is very useful.

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Wed Jul 11 2001 - 11:50:21 CDT

Original text of this message

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