• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

类似于split的作用 将字符串, 分隔开成字符数组

mysql 搞代码 4年前 (2022-01-09) 13次浏览 已收录 0个评论

也是从一个开源的软件中看到的 就冒昧的拿了出来 PL/SQL split proc本文来源gaodai$ma#com搞$代*码6网edure comma_to_arr(list in varchar2, arr out col_head_arr, lenarr out integer) is type col_head_arr is table of varchar2(50) index by binary_integer; l_arr col_head_arr;–字符数

也是从一个开源的软件中看到的 就冒昧的拿了出来

PL/SQL split <style> .CodeEntity .code_pieces ul.piece_anchor{width:25px;position:absolute;top:25px;left:-30px;z-index:1000;} .CodeEntity .code_pieces ul.piece_anchor li{width:25px;background: #efe;margin-bottom:2px;} .CodeEntity .code_pieces ul.piece_anchor li{border-left:3px #40AA63 solid;border-right:3px #efe solid;} .CodeEntity .code_pieces ul.piece_anchor li:hover{border-right:3px #40AA63 solid;border-left:3px #efe solid;} .CodeEntity .code_pieces ul.piece_anchor li a{color: #333;padding: 3px 10px;} .CodeEntity .code_pieces .jump_to_code{visibility:hidden;position:relative;} .CodeEntity .code_pieces .code_piece:hover .jump_to_code{visibility:visible;} .CodeEntity .code_pieces .code_piece:hover .jump_to_code a{text-decoration:none;} .CodeEntity .code_pieces h2 i{float:right;font-style:normal;font-weight:normal;} .CodeEntity .code_pieces h2 i a{font-size:9pt;background: #FFFFFF;color:#00A;padding: 2px 5px;text-decoration:none;} </style> <!—ecms

    –> <!—ecms

  • $velocityCount
  • –> <!—ecms

–>

 procedure comma_to_arr(list   in varchar2,                         arr    out col_head_arr,                         lenarr out integer) is    type col_head_arr is table of varchar2(50) index by binary_integer;    l_arr       col_head_arr;--字符数组    i           integer;--    str_start   integer;    arr_counter integer;  begin    -- first check if it is null    --如果为空 就直接返回空的数组 ,标记长度为0    if length(list) = 0 then      arr    := l_arr;      lenarr := 0;      return;    end if;      i           := 1;    str_start   := 1;    arr_counter := 0;    --循环条件 字符扫描位置小于字符长度+1    while i  length(list) or substr(list, i, 1) = ',' then        --要数组长度递增        arr_counter := arr_counter + 1;        --将 浮标位置开始 以及到 ,之间的 字符保存        l_arr(arr_counter) := substr(list, str_start, i - str_start);        --将浮标 设定为,后的下一个字符         str_start := i + 1;      end if;      --移动 字符扫描位置      i := i + 1;    end loop;    arr    := l_arr;    lenarr := arr_counter;  end;

搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:类似于split的作用 将字符串, 分隔开成字符数组
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址