oracle根据分隔符将字符串分割成数组函数
--创建表类型
create or replace type mytype as table of number;
--如果定义成varchar
--CREATE OR REPLACE type mytype as table of varchar2(4000);
-- 将字符串分割成数组
function my_split(piv_str in varchar2, piv_delimiter in varchar2)
--piv_str 为字符串,piv_delimiter 为分隔符
return mytype is
j int := 0;
i int := 1;
len int := 0;
len1 int := 0;
str varchar2(4000);
my_split mytype := mytype();
begin
len := length(piv_str);
len1 := length(piv_delimiter);
while j < len loop
j := instr(piv_str, piv_delimiter, i);
if j = 0 then
j := len;
str := substr(piv_str, i);
my_split.extend;
my_split(my_split.count) := str;
if i >= len then
exit;
end if;
else
str := substr(piv_str, i, j - i);
i := j + len1;
my_split.extend;
my_split(my_split.count) := str;
end if;
end loop;
return my_split;
end my_split;
oracle根据分隔符将字符串分割成数组函数的更多相关文章
- shell 将字符串分割成数组
代码:test.sh #!/bin/bash a="one,two,three,four" #要将$a分割开,可以这样: OLD_IFS="$IFS" IFS= ...
- Linux shell 将字符串分割成数组
原文链接:http://1985wanggang.blog.163.com/blog/static/776383320121745626320/ a="one,two,three,four& ...
- [转+整理]linux shell 将字符串分割成数组
原文链接:http://1985wanggang.blog.163.com/blog/static/776383320121745626320/ a="one,two,three,four& ...
- sql server 将字符串分割成表函数 strsplitetotable
在sql server里,调用存储过程时,经常需要将数据拼成字符串做为参数调用存储过程,而在储存过程中分割字符串虽然简单但麻烦,封装了该函数,可以将拼串分割成内存表返回,方便使用,返回的表字段从a,b ...
- 字符串---分割成数组(str_split ),算出一个字符串中出现最多的字符, 学校中最多的姓名
split 分割separate分开 little 小的 echo '<meta http-equiv="Content-type" content="text/h ...
- php把字符串指定字符分割成数组
<?php $str="1|2|3|4|5|"; $var=explode("|",$str); print_r($var); ?> $var=ex ...
- 随笔 JS 字符串 分割成字符串数组 并动态添加到指定ID的DOM 里
JS /* * 字符串 分割成字符串数组 并动态添加到指定ID的DOM 里 * @id 要插入到DOM元素的ID * * 输入值为图片URL 字符串 * */ function addImages(i ...
- js 字符串分割成字符串数组 遍历数组插入指定DOM里 原生JS效果
使用的TP3.2 JS字符串分割成字符串数组 var images='{$content.pictureurl} ' ;结构是这样 attachment/picture/uploadify/20141 ...
- split 将字符串分割成字符串数组
list_name = list_name.split(","); split() 方法用于把一个字符串分割成字符串数组. 语法 stringObject.split(separa ...
随机推荐
- applicationContext.xml和web.xml的一些配置
applicationContext.xml <!-- test环境 --> <beans profile="test"> <context:prop ...
- 项目Postmortem
设想和目标 我们的软件要解决什么问题?是否定义得很清楚?是否对典型用户和典型场景有清晰的描述? 解决网站前端的数据处理以及获取问题,定义的很清楚,对于典型用户也比较清晰,因为主要只有一个用户,所以对于 ...
- TestDisk 恢复rm -rf 的文件
Linux操作系统下使用TestDisk恢复已删除的文件或目录 原创作者:szyzln/2015.10.16 转载需注明原始出处! 说明: testdisk和photorec是著名的恢复数据,而绝 ...
- JSBinding / Memory Management (GC)
C# and JavaScript both have Garbage Collection (GC). They should not conflict with each other. Class ...
- jquery选择器之层级选择器
HTML示例代码 <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...
- LeetCode "Valid Perfect Square"
Typical binary search.. but take care of data overflow if you are using C++ class Solution { public: ...
- 【AT91SAM3S】SAM3S-EK Demo工程中,LCD驱动程序的加载(函数指针结构体)
为了调试LCD,在英倍特的板子上烧Atmel的sam3s-ek_demo_1.4_source示例代码.LCD显示正常了,却找不到LCD的驱动究竟在哪. 花了好久,追踪到了这个执行过程. 进入main ...
- 核心动画和UIView动画的区别
核心动画和UIView动画的区别 1.核心动画制作用在Layer 2.核心动画的修改的属性都是假象,他的真实位置没有发生变化()
- 少见的sql
1,values 的新用法,出现自2008 SELECT * FROM table AS a ,,,'qq3')) tem(id,name) ON a.id=tem.id insert into xx ...
- gc之四--Minor GC、Major GC和Full GC之间的区别
针对HotSpot VM的实现,它里面的GC其实准确分类只有两大种: Partial GC:并不收集整个GC堆的模式 Young GC:只收集young gen的GC Old GC:只收集old ge ...