create or replace function splitstr(p_string in varchar2,
p_delimiter in varchar2)
return str_split
pipelined as
v_length number := length(p_string);
v_start number := 1;
v_index number;
/*by lhp 2011-04-09
測試select * from table(splitstr('henry,huang',','));
行列轉化
select a.column_value name1,b.column_value name1 from
(select * from (select rownum rn,t.* from table(splitstr('henry,huang',',')) t)) a,
(select * from (select rownum rn,t.* from table(splitstr('henry,huang',',')) t)) b
where a.rn=1 and b.rn=2
*/begin
while (v_start <= v_length) loop
v_index := instr(p_string, p_delimiter, v_start);
if v_index = 0 then
pipe row(substr(p_string, v_start));
v_start := v_length + 1;
else
pipe row(substr(p_string, v_start, v_index - v_start));
v_start := v_index + 1;
end if;
end loop;
return;
end splitstr;
oracle拆分字串
create or replace type array string is table of varchar2 2000 create or replace function f split string 拆分字串 author zhaohuihua i src in varchar2,待拆分的字...
oracle拆分字串
procedure hand mid sys bpm use role iorgtype in bpm compsite user.orgtype type,idate in date is v orgtype bpm compsite user.orgtype type iorgtype v id...
Oracle拆分字串函式
原文中 有個錯誤 v start v length 1 雖然設定下次查詢起點為字串長度 1,但下次v index還是0,程式不會退回。程式沒有退出條件,故本句應改出使程式退出。exit 還有,原文中未檢測傳入的字串引數為null或為空的情況 此時返回的v index為空 下面改正了,見紅色字型部分。...