oracle 按指定字符拆分字符串为数组表格StrSplit
oracle 按指定字符拆分字符串为数组表格StrSplit,使用背景:入参传多个编码值'111,222,333',转换为 in ('111','222','333')
oracle 按指定字符拆分字符串为数组表格StrSplit,使用背景:入参传多个编码值’111,222,333’,转换为 in (‘111’,‘222’,‘333’)
CREATE OR REPLACE FUNCTION StrSplit(p_value varchar2, p_split varchar2 := ‘,’)
return strsplit_type
pipelined is
v_index integer;
v_value varchar2(500);
v_strs_last varchar2(4000) := p_value;
begin
loop
v_index := instr(v_strs_last, p_split);
exit when v_index = 0;
v_value := substr(v_strs_last, 1, v_index - 1);
v_strs_last := substr(v_strs_last, v_index + 1);
pipe row(v_value);
end loop;
pipe row(v_strs_last);
return;
end StrSplit;
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)