小编Vel*_*ity的帖子

通过 pl/sql 过程将带有行间隙和空值的逗号分隔值拆分到表中的列中

我在表中有一个字符串、clob 值,我需要将其拆分为列。源表查询:

Insert into disp_data(id,data) values(100,
'"Project title as per the outstanding Requirements","The values are not with respect to the requirement and analysis done by the team. 
Also it is difficult to prepare a scenario notwithstanding the fact it is difficult. This user story is going to be slightly complex however it is up to the team","Active","Disabled","25 tonnes of fuel","www.examplesites.com/html.asp&net;","","","","","25"');
Run Code Online (Sandbox Code Playgroud)

在 clob 列值中也存在空格、空值和行间隙。所以当我尝试使用分割它时

select regexp_substr(data,'[^,]+',1,level) from disp_data 
connect by regexp_substr(data,'[^,]+',1,level) is not null.
Run Code Online (Sandbox Code Playgroud)

问题是对于有行间隙的大文本,它会将其分成不同的行。我曾想过使用上面的结果集和数据透视表,但无法做到。

我需要将此数据作为列获取并推入目标表-push_data_temp。

select pid,col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11 from push_data_temp;
Run Code Online (Sandbox Code Playgroud)

clob …

sql oracle plsql regexp-substr

1
推荐指数
1
解决办法
1348
查看次数

标签 统计

oracle ×1

plsql ×1

regexp-substr ×1

sql ×1