I need to update table B
with column Value with CLOB
type from table A
Table A
ID Value
1001 ABC
1002 CDE
1003 ABC
1004 PWD
Table B
to be updated as below:
ID - varchar2(355)
Value - CLOB
ID Value
ABC 1001!1003
CDE 1002
PWD 1004
Looks more like an INSERT
, not UPDATE
. Anyway, LISTAGG
will help in both cases.
SQL> insert into b (id, value)
2 select a.value, listagg(a.id, '!') within group (order by a.id)
3 from a
4 group by a.value;
3 rows created.
SQL> select * From b;
ID VALUE
---------- --------------------------------------------------
ABC 1001!1003
CDE 1002
PWD 1004
SQL>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.