create or replace function checkContainStr
    /******************************
    description:比对两个传入的字符串是否含有相同的字符串,并返回相同的数量
    author:lwh date:2011-12-18 ver:1.0
    ********************************/
    (strSource in varchar2,strTarget in varchar2,splitMark in varchar2) return pls_integer as
    j INT := 0;
    i INT := 1;
    len INT := 0;
    len1 INT := 0;
    str VARCHAR2 (4000);
    counts pls_integer:=0;
    begin
       len := LENGTH (strSource);
       len1 := LENGTH (splitMark);

      WHILE j < len
      LOOP
          j := INSTR (strSource, splitMark, i);

          IF j = 0
          THEN
              j := len;
            str := SUBSTR (strSource, i);
            if instr(strTarget,str)>0 then
              counts:=counts+1;
            end if;

              IF i >= len
              THEN
                EXIT;
            END IF;
          ELSE
            str := SUBSTR (strSource, i, j - i);
            i := j + len1;
            if instr(strTarget,str)>0 then
              counts:=counts+1;
            end if;
        END IF;
    END LOOP;

      RETURN counts;
    end;

 

相关文章:

  • 2021-04-02
  • 2021-06-30
  • 2021-12-03
  • 2021-11-18
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
猜你喜欢
  • 2021-07-08
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-11-18
相关资源
相似解决方案