사용자정의한 SPLIT함수
WITH
T( SPLIT_STR, ORDINAL, START, end) AS
( SELECT 'Ford@Toyota@Nissan' SPLIT_STR, 0,0,0 FROM DUAL
UNION ALL
SELECT SPLIT_STR , ORDINAL+1,
CASE END
WHEN 0 THEN 1
ELSE end+2
END,
CASE LOCATE('@', SPLIT_STR, end+2)
WHEN 0 THEN LENGTH(SPLIT_STR)
ELSE LOCATE('@', SPLIT_STR, end+2)-1
END
FROM T
WHERE end < LENGTH(SPLIT_STR)
)
SELECT ORDINAL, SUBSTR(SPLIT_STR, START, END-START+1) AS NAME
FROM T
WHERE ORDINAL =2
|