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 输出的更多相关文章

  1. sql按字符截取字段

    字段A=’F:\photo\Winter Leaves.jpg’ 要求:分段截取每段字符[字段A不能为TEXT类型,否则报错] 解决方法: ---截取字符串A的第一个\左边的字符串 ) 输出结果:F: ...

  2. mysql截取字段并插入到新的字段中

    例如:在产品表product表中字段content值为["10"],然后在产品表中新建一个字段product_id,提出字段content的值10,如何实现呢? 解: update ...

  3. 页面截取字段和转码,页面截取字段时候需要进入JS

    截取字段    ${fn:substring(info.cpflmc,0,20)}${fn:length(info.cpflmc)>40?'...':''}             表头list ...

  4. oracle截取字段中的部分字符串

    使用Oracle中Instr()和substr()函数: 在Oracle中可以使用instr函数对某个字符串进行判断,判断其是否含有指定的字符. 其语法为: instr(sourceString,de ...

  5. sql查询调优之where条件排序字段以及limit使用索引的奥秘

       奇怪的慢sql 我们先来看2条sql 第一条: select * from acct_trans_log WHERE  acct_id = 1000000000009000757 order b ...

  6. spring mongodb分页,动态条件、字段查询

    使用MongRepository public interface VideoRepository extends MongoRepository<Video, String> { Vid ...

  7. SQL性能优化-查询条件与字段分开执行,union代替in与or,存储过程代替union

    PS:概要.背景.结语都是日常“装X”,可以跳过直接看优化历程 环境:SQL Server 2008 R2.阿里云RDS:辅助工具:SQL 审计 概要 一个订单列表分页查询功能,单从SQL性能来讲,从 ...

  8. SQL截取字段字符串的方法

    set @str='WX15-53-H-53-99-15-335-23'; select @str as '字符串' select len(@str) as '字符长度' select charind ...

  9. 截取字段split

    172.0.0.1String[] splitAddress=qip.split("\\.");//--172001 String ip=splitAddress[0]+" ...

随机推荐

  1. Java编辑PDF写入文字 插入图片

    package com.test; import com.itextpdf.text.BaseColor; import com.itextpdf.text.Font; import com.itex ...

  2. 《算法》第一章部分程序 part 2

    ▶ 书中第一章部分程序,加上自己补充的代码,包括简单的计时器,链表背包迭代器,表达式计算相关 ● 简单的计时器,分别记录墙上时间和 CPU 时间. package package01; import ...

  3. 《GPU高性能编程CUDA实战》第六章 常量内存

    ▶ 本章介绍了常量内存的使用,并给光线追踪的一个例子.介绍了结构cudaEvent_t及其在计时方面的使用. ● 章节代码,大意是有SPHERES个球分布在原点附近,其球心坐标在每个坐标轴方向上分量绝 ...

  4. python中的pop

    pop()将列表指定位置的元素移除,同时可以将移除的元素赋值给某个变量,不填写位置参数则默认删除最后一位 pop()根据键将字典中指定的键值对删除,同时可以将删除的值赋值给变量 举个例子: 1 a = ...

  5. 微信支付开发出现redirect_uri参数错误的解决方法

    我们在进行微信支付开发的时候会遇到出现“redirect_uri参数错误”这种情况,怎么办呢?下面就是我总结出现这种“redirect_uri参数错误”的七种可能情况,以及解决方式. 1.可能原因①: ...

  6. c#调用带输出参数的存储过程

    sql server中编写一个存储过程: CREATE PROCEDURE ProGetPWD @username varchar(20), @password varchar(20) OUTPUT ...

  7. git 简单的操作命令

    1, 克隆已存在项目 => git clone url 2, 拉取代码 => git pull 3,  配置账号密码 git config --global user.email &quo ...

  8. leetcode218

    from heapq import * class Solution: def getSkyline(self, LRH): skyline = [] i, n = 0, len(LRH) liveH ...

  9. 如何在notepad++实现代码自动化排版(调用Astyle)

    我先介绍这个怎么在notepad++中调用原版的astyle的方法. 在notepad++:运行或是F5, 在输入框中选择astyle.exe所在的目录,什么你没有astyle,下载地址https:/ ...

  10. js弹出div层,弹出层页面底部出现UL出现一条线问题

    整个弹出div层,列表满一页时:底部会出现一条横线 原因:ul固定写在页面中了 解决方法: 将ul代码与li列表一样写在js中,如下 var newhtml = '<ul class=" ...