SELECT DISTINCT TRIM (EXTRACT (VALUE (d), '//row/text()').getstringval ())
FROM (SELECT XMLTYPE ( '
|| REPLACE ('47 X 48 X 49'
,'X'
,'
|| '
' ) AS xmlval
FROM DUAL) x
,TABLE (XMLSEQUENCE (EXTRACT (x.xmlval, '/rows/row'))) d;
Answer:
47
48
49
WITH t AS (SELECT '47" , 48" , 49"' str FROM DUAL
)
select Distinct trim(substr(str,
decode(level,
1,
1,
instr(str, ',', 1, level - 1) + 1),
decode(instr(str, ',', 1, level),
0,
length(str),
instr(str, ',', 1, level) -
decode(level,
1,
0,
instr(str, ',', 1, level - 1)) - 1))) the_value
from (select str from t)
connect by level <=
length(str) - length(replace(str, ',')) + 1;
Ans)
47"
48"
49"
No comments:
Post a Comment