使用表函数切割字符串
发布时间:2021-01-13 21:45:42 所属栏目:编程 来源:网络整理
导读:本日PHP站长网 52php.cn把网络自互联网的代码分享给各人,仅供参考。 CREATE OR REPLACE TYPE table_userid is table of varchar2(100); create or replace function get_userid_tab(v_str in varchar2) return table_use
|
以下代码由PHP站长网 52php.cn网络自互联网 此刻PHP站长网小编把它分享给各人,仅供参考 CREATE OR REPLACE TYPE table_userid is table of varchar2(100);
create or replace function get_userid_tab(v_str in varchar2) return table_userid pipelined as
v_new_str varchar2(4000);
begin
if nvl(v_str,null) is not null then
v_new_str:=v_str;
while 1=1 loop
if instr(v_new_str,',')=0 then
pipe row(to_number(v_new_str));
exit;
else
pipe row(to_number(substr(v_new_str,1,instr(v_new_str,')-1)));
v_new_str:=substr(v_new_str,')+1);
end if;
end loop;
end if;
return;
end;
测试: select * from table(get_userid_tab('16,17,18,19,20'));
功效:
16
17
18
19
20
以上内容由PHP站长网【52php.cn】网络清算供各人参考研究 假如以上内容对您有辅佐,接待保藏、点赞、保举、分享。 (编辑:湖南网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |


