Home > Net >  Columns to row converting
Columns to row converting

Time:07-14

Table_A:

AA
BB
CC
DD

Output:

AA,BB,CC,DD

Any one help this

CodePudding user response:

LISTAGG seems to be one choice:

Sample data:

SQL> with table_a(col) as
  2  (select 'AA' from dual union all
  3   select 'BB' from dual union all
  4   select 'CC' from dual union all
  5   select 'DD' from dual
  6  )

Query:

  7  select listagg(col, ',') within group (order by col) result
  8  from table_a;

RESULT
------------------------------
AA,BB,CC,DD

SQL>

CodePudding user response:

informatica only solution -

  1. SRT : sort the data by col1.
  2. EXP : create 3 ports. make sure their length be >3000 char
in_col1 = col1
v_col1 = col1|v_col1
p_col1= col1
o_col1= v_col1
  1. AGG: create 2 ports
in_col1 <-- link o_col1 from previous step2
o_col1 = MAX(in_col1) -- link this to final target

Normally, there should be a key column by which you want to aggregate the strings. if you have any, you need to change step2 in v_col1.

  • Related