« oracle 实现 split 函数 (返回数组)« »Oracle PL/SQL游标的学习 »
oracle相当于split功能的代码
CREATE OR REPLACE Function VIPJF.Get_Field_Value(in_str IN varchar2,findstr in varchar2, field in integer )
return varchar2
AS
tmp_msg varchar2(20);
-- 取字段 值 ,field start from 0
startidx integer;
endidx integer;

begin
startidx := 1;
endidx := 1;

for i in 1..field loop
--INSTR(in_string,'|',tmp_pos);
--substr(in_string,tmp_pos,tmp_pos1-tmp_pos);
if i > 1 then
startidx := INSTR(in_str,findstr,startidx);
if startidx = 0 then return null; end if;
startidx := startidx + length(findstr);
end if;
end loop;

endidx := INSTR(in_str,findstr,startidx);
if endidx = 0 then endidx := length(in_str)+1; end if;

return substr(in_str,startidx,endidx - startidx);

exception when others then
return null ;
end;

参考下

in_trade_code := Get_Field_Value(tmp_instr,'|',1);  


Tags: oracle数据库  sql编程  

原创文章如转载,请注明:转载自:飞扬部落编程仓库 : http://www.busfly.net/csdn/

本文链接地址:http://www.busfly.net/csdn/post/313.html

如果你喜欢本文,请顶一下,支持我,你的支持是我继续发好文章的最大动力。谢谢。
好东西需要分享,快把本文发给你的朋友吧~!~

     
相关文章:
oracle 实现 split 函数 (返回数组)  (2007-11-28 21:1:32)
在oracle中手动创建split函数  (2007-11-28 21:0:6)
Oracle时间函数  (2007-11-28 16:40:27)
oracle 存储过程语法例子  (2007-11-27 10:15:53)
JOIN用法  (2007-11-27 10:2:8)
经典连接查询示例  (2007-11-27 10:1:38)
精妙SQL语句整理  (2007-11-27 10:0:11)
全面接触SQL语法(7)  (2007-11-27 9:57:34)
全面接触SQL语法(6)  (2007-11-27 9:57:0)
全面接触SQL语法(5)  (2007-11-27 9:56:29)




◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
Feed订阅集
网站分类
勤劳致富^.^
最近发表
最新评论及回复
最近留言
随机推荐文章
Powered By Z-Blog   STYLE by busfly . FatMouse
Copyright © 2007 巴士飞扬技术博客. . 沪ICP备07027972号. 会员群1(VS为主):3769186.