使用表函数切割字符串
发布时间:2021-01-13 04:43:48 所属栏目:MySql教程 来源:网络整理
导读:今天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】收集整理供大家参考研究 如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。 (编辑:好传媒网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |