温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

单字节处理函数

发布时间:2020-08-10 18:05:26 来源:ITPUB博客 阅读:139 作者:xypincle 栏目:大数据

  • CREATE OR REPLACE Function ZL_GetSinglebyte_string
  • (
  •   strValue_IN varchar2,
  •   numValue_IN number
  • )
  • Return Varchar2 Is
  •    v_temp varchar2(200);
  •    v_return varchar2(200);
  •    v_num number:=0;
  •    v_sum number:=0;
  •    idx number :=1 ;
  •    idy number :=0 ;
  • BEGIN
  •   IF lengthb(strValue_IN)>=numValue_IN then
  •       WHILE idx <= LENGTH(strValue_IN) LOOP
  •          v_temp := SUBSTR(strValue_IN,idx,1);
  •          v_num := v_num + lengthb(v_temp);
  •          if v_num > numValue_IN then
  •             v_return := v_return||substr(strValue_IN,1,idx-1)||' ';
  •             exit;
  •          elsif v_num = numValue_IN then
  •             v_return := v_return||substr(strValue_IN,1,idx);
  •             exit;
  •          else
  •             idx := idx + 1 ;
  •          END IF;
  •       END LOOP;
  •    ELSE
  •      v_sum := numValue_IN - LENGTHB(strValue_IN);
  •      v_return := v_return||strValue_IN;
  •      WHILE idy < v_sum LOOP
  •         v_return := v_return||' ';
  •         idy := idy + 1;
  •      END LOOP;
  •    END IF;
  •    IF mod(lengthb(strValue_IN),2) = 0 then
  •       v_return := v_return || ' |';
  •    ELSE
  •       v_return := v_return || '|';
  •    END IF;
  •    Return v_return;
  • Exception
  •   When Others Then
  •     Zl_Errorcenter(Sqlcode, Sqlerrm);
  • END ZL_GetSinglebyte_string;


  • 建同义词:
  • create or replace public synonym ZL_GetSinglebyte_string
  • for HIS.ZL_GetSinglebyte_string;
  • ----------------------------------------------------------
  • GRANT EXECUTE ON ZL_GetSinglebyte_string to public

  • 向AI问一下细节

    免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

    AI