Programming/Oracle

오라클 UNPIVOT

초록깨비 2023. 8. 31. 10:26
728x90

select cust, business_no, col_nm, col_value
  from (
         select * --cust, business_no, cust_nm, cust_knm, cust_enm
           from ct0002ac 
           where end_yn = 'N'  
        )
unpivot (col_value for col_nm in (cust_nm, cust_knm, cust_enm)

 


 -- col_nm, col_value : 임의 지정
 -- col_nm : 칼럼명을 표시할 항목명 지정  
 -- col_value : 컬럼값을 표시할 항목명 지정
 -- in (실제 칼럼, 칼럼, ...)  

                                            

 

 

   

 

 

728x90