zoukankan      html  css  js  c++  java
  • 根据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
  • 相关阅读:
    N in 1 & 多重引导光盘制作
    可启动 ISO 合并、Windows 安装光盘合集
    VS 2005 VC++ 文件类型
    Windows 无人值守安装应答文件详解
    30种下载Youtube视频的方法
    解释YOUTUBE FLV 地址
    Windows下进程通信方式[转]
    进程通讯 DELPHI的类实现
    c#.net常用函数列表
    Javascript, How to make a Dress Up Game (Drag and Drop)
  • 原文地址:https://www.cnblogs.com/zhangwensi/p/4156588.html
Copyright © 2011-2022 走看看