Oracle sql: case when then 의 용법 노트

단일 조건
select 
-- company1  null     company2         company1
(case when t.company1 is null then t.company2 else t.company2 end)as company   
from tablename t

다 조건
select 
--  pname1   null     pname1  
--  pname2   null     pname2
--      pname3
(case when t.pname1 is not null then t.pname1 
      when t.pname2 is not null then t.pname2
      else t.pname3 end) as t.pname3
from tablename t  

  :
        select              
pname     select       
      1    pname1     
      2    pname2   
.
.
  pname         sql             

좋은 웹페이지 즐겨찾기