SELECT X.TN
, X.C1||', '||X.C2||', '||X.C3||', '||X.C4||', '||X.C5||', '||X.C6||', '||X.C7||', '||X.C8||', '||X.C9||', '||X.C10||
', '||X.C11||', '||X.C12||', '||X.C13||', '||X.C14||', '||X.C15||', '||X.C16||', '||X.C17||', '||X.C18||', '||X.C19||', '||X.C20||
', '||X.C21||', '||X.C22||', '||X.C23||', '||X.C24||', '||X.C25||', '||X.C26||', '||X.C27||', '||X.C28||', '||X.C29||', '||X.C30||
', ' ||X.C31||', '||X.C32||', '||X.C33 AS CL
FROM (
SELECT TABLE_NAME TN
, MAX(CASE COLUMN_ID WHEN 1 THEN COLUMN_NAME END) C1
, MAX(CASE COLUMN_ID WHEN 2 THEN COLUMN_NAME END) C2
, MAX(CASE COLUMN_ID WHEN 3 THEN COLUMN_NAME END) C3
, MAX(CASE COLUMN_ID WHEN 4 THEN COLUMN_NAME END) C4
, MAX(CASE COLUMN_ID WHEN 5 THEN COLUMN_NAME END) C5
, MAX(CASE COLUMN_ID WHEN 6 THEN COLUMN_NAME END) C6
, MAX(CASE COLUMN_ID WHEN 7 THEN COLUMN_NAME END) C7
, MAX(CASE COLUMN_ID WHEN 8 THEN COLUMN_NAME END) C8
, MAX(CASE COLUMN_ID WHEN 9 THEN COLUMN_NAME END) C9
, MAX(CASE COLUMN_ID WHEN 10 THEN COLUMN_NAME END) C10
, MAX(CASE COLUMN_ID WHEN 11 THEN COLUMN_NAME END) C11
, MAX(CASE COLUMN_ID WHEN 12 THEN COLUMN_NAME END) C12
, MAX(CASE COLUMN_ID WHEN 13 THEN COLUMN_NAME END) C13
, MAX(CASE COLUMN_ID WHEN 14 THEN COLUMN_NAME END) C14
, MAX(CASE COLUMN_ID WHEN 15 THEN COLUMN_NAME END) C15
, MAX(CASE COLUMN_ID WHEN 16 THEN COLUMN_NAME END) C16
, MAX(CASE COLUMN_ID WHEN 17 THEN COLUMN_NAME END) C17
, MAX(CASE COLUMN_ID WHEN 18 THEN COLUMN_NAME END) C18
, MAX(CASE COLUMN_ID WHEN 19 THEN COLUMN_NAME END) C19
, MAX(CASE COLUMN_ID WHEN 20 THEN COLUMN_NAME END) C20
, MAX(CASE COLUMN_ID WHEN 21 THEN COLUMN_NAME END) C21
, MAX(CASE COLUMN_ID WHEN 22 THEN COLUMN_NAME END) C22
, MAX(CASE COLUMN_ID WHEN 23 THEN COLUMN_NAME END) C23
, MAX(CASE COLUMN_ID WHEN 24 THEN COLUMN_NAME END) C24
, MAX(CASE COLUMN_ID WHEN 25 THEN COLUMN_NAME END) C25
, MAX(CASE COLUMN_ID WHEN 26 THEN COLUMN_NAME END) C26
, MAX(CASE COLUMN_ID WHEN 27 THEN COLUMN_NAME END) C27
, MAX(CASE COLUMN_ID WHEN 28 THEN COLUMN_NAME END) C28
, MAX(CASE COLUMN_ID WHEN 29 THEN COLUMN_NAME END) C29
, MAX(CASE COLUMN_ID WHEN 30 THEN COLUMN_NAME END) C30
, MAX(CASE COLUMN_ID WHEN 31 THEN COLUMN_NAME END) C31
, MAX(CASE COLUMN_ID WHEN 32 THEN COLUMN_NAME END) C32
, MAX(CASE COLUMN_ID WHEN 33 THEN COLUMN_NAME END) C33
FROM COLS
WHERE TABLE_NAME = '테이블 명'
GROUP BY TABLE_NAME
) X