Tuesday, July 22, 2014

To find the Nth Record from Comma Separated String

REGEXP_SUBSTR :

SELECT REGEXP_SUBSTR(MYCOL, '[^,]+', 1, 2) AS VAL
FROM
( SELECT 'ORACLE IS A,OCEAN,TRY,TO SWIM,AS MUCH AS,YOU CAN' AS MYCOL FROM DUAL);

O/P :
DOG

to get 4th value just change as below
REGEXP_SUBSTR(MYCOL, '[^,]+', 1, 4)

Related Posts :

Elimination of Special Characters In the String

Challa.

No comments:

Post a Comment