Link to home
Start Free TrialLog in
Avatar of Maliki Hassani
Maliki HassaniFlag for United States of America

asked on

Splitting values into their own record

In oracle if I have a table called "Member diagnosis" that has a column called "diagnosis code"  with a value of d1|d2|d3|d4.  What is the syntax to split out each diagnosis code into its own record?

Thanks
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Try this:
select
	regexp_substr(diagnosis_code,'[^|]+',1,1) d1,
	regexp_substr(diagnosis_code,'[^|]+',1,2) d2,
	regexp_substr(diagnosis_code,'[^|]+',1,3) d3,
	regexp_substr(diagnosis_code,'[^|]+',1,4) d4
from member_diagnosis
/

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Maliki Hassani

ASKER

Thank you, sir