|
目前采用的方案:
- create or replace type type_split as table of varchar2(4000);
- create or replace function test_split(p_list VARCHAR2, p_sep VARCHAR2) return type_split
- PIPELINED IS
- l_idx PLS_INTEGER;
- v_list VARCHAR2(32767) := p_list;
- begin
- LOOP
- l_idx := instr(v_list, p_sep);
- IF l_idx > 0 THEN
- PIPE ROW(substr(v_list, 1, l_idx - 1));
- v_list := substr(v_list, l_idx + length(p_sep));
- ELSE
- PIPE ROW(v_list);
- EXIT;
- END IF;
- END LOOP;
- RETURN;
- end test_split;
复制代码
SELECT * FROM table(test_split('P071813,P071814,P071815',',')) |
|