oracle 去除重复字符串函数
来源:互联网 发布:美津浓跑鞋矩阵图 编辑:程序博客网 时间:2024/05/18 07:07
create or replace function MyReplace(oldStr varchar2, sign varchar2) return varchar2 is
str varchar2(1000);
currentIndex number;
startIndex number;
endIndex number;
type str_type is table of varchar2(30)
index by binary_integer;
arr str_type;
Result varchar2(1000);
begin
if oldStr is null then
return ('');
end if;
str := oldStr;
currentIndex := 0;
startIndex := 0;
loop
currentIndex := currentIndex + 1;
endIndex := instr(str, sign, 1, currentIndex);
if (endIndex <= 0) then
exit;
end if;
arr(currentIndex) := trim(substr(str, startIndex + 1, endIndex - startIndex - 1));
startIndex := endIndex;
end loop;
arr(currentIndex) := substr(str, startIndex + 1, length(str));
for i in 1.. currentIndex - 1 loop
for j in i + 1..currentIndex loop
if arr(i) = arr(j) then
arr(j) := '';
end if;
end loop;
end loop;
str := '';
for i in 1..currentIndex loop
if arr(i) is not null then
str := str || sign || arr(i);
arr(i) := '';
end if;
end loop;
Result := substr(str, 2, length(str));
return(Result);
end MyReplace;
str varchar2(1000);
currentIndex number;
startIndex number;
endIndex number;
type str_type is table of varchar2(30)
index by binary_integer;
arr str_type;
Result varchar2(1000);
begin
if oldStr is null then
return ('');
end if;
str := oldStr;
currentIndex := 0;
startIndex := 0;
loop
currentIndex := currentIndex + 1;
endIndex := instr(str, sign, 1, currentIndex);
if (endIndex <= 0) then
exit;
end if;
arr(currentIndex) := trim(substr(str, startIndex + 1, endIndex - startIndex - 1));
startIndex := endIndex;
end loop;
arr(currentIndex) := substr(str, startIndex + 1, length(str));
for i in 1.. currentIndex - 1 loop
for j in i + 1..currentIndex loop
if arr(i) = arr(j) then
arr(j) := '';
end if;
end loop;
end loop;
str := '';
for i in 1..currentIndex loop
if arr(i) is not null then
str := str || sign || arr(i);
arr(i) := '';
end if;
end loop;
Result := substr(str, 2, length(str));
return(Result);
end MyReplace;
0 0
- oracle 去除重复字符串函数
- oracle sql 字符串去除重复字符函数
- oracle 去除重复字符函数
- 字符串聚合函数(去除重复值)
- mysql 去除重复字符串的函数
- java去除重复字符串
- java 字符串去除重复
- js去除重复字符串
- JS去除重复字符串
- 去除字符串重复数据
- 去除字符串重复数据
- JS去除重复字符串
- 去除字符串重复部分
- JS去除重复字符串
- 字符串去除重复字母
- js 字符串去除重复
- 去除重复字符串
- ORACLE 去除重复记录
- Java设计模式_行为型_观察者模式_任意行为的监听
- Android 代码片段(一)
- iOS两个app应用之间的互相跳转
- Jquery-zTree的基本用法
- 将h.264视频流封装成flv格式文件(一.flv格式)
- oracle 去除重复字符串函数
- 研究-数据库死锁
- 三层架构——三层登录类图与序列图
- 不光是查找值!"二分搜索"总结
- 浅谈透明计算与云计算的区别
- App提交iTunes Connect,"二进制无效"问题解决方案。
- InputType问题
- Mac 输入法符号
- Java操作MongoDB