Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: views if and case statements
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
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 CorpReceived on Wed Jul 11 2001 - 11:50:21 CDT
![]() |
![]() |