Skip to content

Instantly share code, notes, and snippets.

@shaik2many
Created August 29, 2012 21:51
Show Gist options
  • Save shaik2many/3519394 to your computer and use it in GitHub Desktop.
Save shaik2many/3519394 to your computer and use it in GitHub Desktop.
oracle - commatext to table
WITH commadata AS (
SELECT '1,1.050,1.050.050,1.050.100,1.050.150,1.050.200,1.100,1.100.050,1.100.050.050,1.100.050.100,1.100.050.150' columnid1, 'word4,word5,word6' columnid2 FROM dual
)
SELECT regexp_substr(columnid1, '[^,]+', 1, level) as parsed_value,
regexp_substr( columnid2, '[^,]+',1, level) as parsed_value
FROM commadata
CONNECT BY LEVEL <= REGEXP_COUNT( columnid1 , '[,]' )+1
ORDER BY 1;
SELECT REGEXP_SUBSTR('500 Oracle Parkway, Redwood Shores, CA', ',[^,]+,') "REGEXPR_SUBSTR" FROM DUAL;
SELECT INSTR('CORPORATE FLOOR','OR', 3, 2) "Instring" FROM DUAL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment