Skip to content

Instantly share code, notes, and snippets.

View jhcao23's full-sized avatar

John Cao jhcao23

View GitHub Profile
@rponte
rponte / split-string-by-token.sql
Last active March 3, 2022 14:13
Oracle PLSQL - splitting string by token using regexp_substr() function
--
-- splitting as columns
--
select regexp_substr('a-b-c', '[^-]+', 1, 1) as grupo_1
,regexp_substr('a-b-c', '[^-]+', 1, 2) as grupo_2
,regexp_substr('a-b-c', '[^-]+', 1, 3) as grupo_3
from dual;
-- result:
-- a b c