Tuesday, July 15, 2014

SQL Query to print Column Values in Row wise

SELECT
   XXHeader_seq,JOB1,value
FROM
   Q_GTF_AUTOCLAVE_LOAD_DATA_V
UNPIVOT
EXCLUDE NULLS
(
   VALUE
   FOR
     JOB1
   IN
   (
      XX_JOB_1,
      XX_JOB_2,
      XX_JOB_3,
      XX_JOB_4,
      XX_JOB_5
   )
)
WHERE
   XXHeader_seq=8980;
  
  
   select regexp_substr('SMITH,ALLEN,WARD,JONES','[^,]+', 1, level) from dual
  connect by regexp_substr('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, level) is not null;

No comments: