• 根据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;
    

      

    欢迎对it热情的同学,加qq进行技术讨论; QQ:850922253
  • 相关阅读:
    页面可视化搭建 整理
    单页面应用(SPA)重新部署后,正在浏览的页面如何更新缓存?
    vim 使用
    浏览器缓存 知识点
    http 2.0 新特性
    GoJS 在 vue 项目中的使用
    详解Vue中watch的高级用法
    什么是 PWA?
    代码风格统一工具:EditorConfig 和 静态代码检查工具:ESLint
    vue-cli 3.x 使用
  • 原文地址:https://www.cnblogs.com/zhangwensi/p/4156588.html
Copyright © 2020-2023  润新知