j'ai essayé ce code que tu as fait
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
CREATE OR REPLACE type s_str AS Object (str Varchar2(227))
/
CREATE OR REPLACE type tab_str AS TABLE of s_str
/
CREATE OR REPLACE FUNCTION tab2Str2
( p_str Varchar2,
p_sep Varchar2 DEFAULT ','
) RETURN tab_str
PIPELINED
IS
l_tab dbms_utility.uncl_array;
l_tablen number;
Begin
dbms_utility.comma_to_table(REPLACE(p_str,p_sep,','), l_tablen, l_tab);
FOR i IN 1..l_tablen Loop
pipe row(s_str(l_tab(i)));
End Loop;
--
RETURN ;
End;
/
SELECT * FROM TABLE( tab2Str2('one|two|three|four|five|six|seven' ,'|'))
/
STR
--------------------------------------------------------------------------
one
two
three
four
five
six
seven |
il fonctionne mais le problème est que si tu as plus de deux lignes dans ta table alors ça marche plus;
ma table est comme ceci :
Col1 Col2
1 test
2
3 test5;test6
4 test7;test8;test9
ce que je souhaiterai c'est quelquechose comme ceci
Col1 Col2
1 test
2
3 test5
3 test6
4 test7
4 test8
4 test9
et il ne ramene pas la COl1, il plante si je la met dans la requête
j'ai fait un truc comme sa
SELECT * FROM TABLE( select Col1,tab2Str2(Col2,';') from matable where Col2 like '%;%')
Partager