select regexp_substr(p.attributename, ‘[^,]+‘,1,level) c1
from tablename p
connect by level <= length(p.attributename) - length(replace(p.attributename,‘,‘,‘‘)) + 1
--创建记录表(包含数据记录)CREATE TABLE old_employee AS SELECT * FROM employee;
create table yyb_serv
(
SERV_CODE VARCHAR2(1024),
CMD_LIST VARCHAR2(100)
)
insert into yyb_serv values(‘111‘,‘1000,10001,10002‘)
select * from yyb_serv
----将一张表结构及表数据 插入到新表中 (数据结构及表数据都会同步)
create table old_yyb_serv AS (select * from yyb_serv)
----将拆分的数据插入到表
insert into yyb_serv(SERV_CODE,CMD_LIST)
select SERV_CODE, regexp_substr(p.CMD_LIST, ‘[^,]+‘,1,level) c1
from yyb_serv p
connect by level <= length(p.CMD_LIST) - length(replace(p.CMD_LIST,‘,‘,‘‘)) + 1
原文地址:https://www.cnblogs.com/yangpeng-jingjing/p/9239125.html
时间: 2024-10-08 15:49:54