首页 > 代码库 > 根据23423条件,截取字段‘abdecsdsadsadsad’,以ab/dec/sdsa/ds/ads 输出
根据23423条件,截取字段‘abdecsdsadsadsad’,以ab/dec/sdsa/ds/ads 输出
create or replace procedure p_getString( p_finalString out varchar2, p_rulestring in number, p_sourceString in varchar2)as v_num number:=1; v_resoucenum number:=1; v_getnum number; v_getsting varchar2(2000); v_errorstring exception; v_errorrule exception;begin if length(p_sourceString) < 18 then raise v_errorstring; else p_finalString:=‘‘; loop v_getnum := substr(p_rulestring, v_num, 1); -- get the numbers from rule v_getsting := substr(p_sourceString, v_resoucenum, v_getnum); -- According to the rule number to get the short String v_resoucenum := v_resoucenum + v_getnum; -- the number of the next short string start position v_num := v_num + 1; p_finalString := p_finalString||v_getsting||‘/‘; -- Splice the short string to the final String dbms_output.put_line(v_resoucenum); if substr(p_rulestring, v_num, 1) is null then exit; end if; end loop; if (v_resoucenum -1) < 18 or(v_resoucenum -1) > 18 then raise v_errorrule; end if; p_finalString := substr(p_finalString, 1, length(p_finalString)-1); end if; exception when v_errorstring then p_finalString:=‘The String length is less than 18!‘; when v_errorrule then p_finalString:=‘The sum value of the rule numbers less than or more then 18!‘; when others then p_finalString:=‘Others wrong‘; end p_getString;
根据23423条件,截取字段‘abdecsdsadsadsad’,以ab/dec/sdsa/ds/ads 输出
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。