Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Split Text

Angus123Nov 18 2024

Hi

I have an address that contains 3 parts seperated by commas.

Eg. A Big Company, 13 New Street, 12345 Glasgow

I need to split this into 3 variables

I can get the first and last parts using

select SUBSTR('A Big Company, 13 New Street, 12345 Glasgow', 0, INSTR('A Big Company, 13 New Street, 12345 Glasgow', ',')-1)
from dual

Returns A Big Company

select substr('A Big Company, 13 New Street, 12345 Glasgow', instr('A Big Company, 13 New Street, 12345 Glasgow', ',', 1, 2)+1)
from dual

Returns 12345 Glasgow

I just cannot figure out how to return the middle part

Help appreciated

Gus

This post has been answered by Cookiemonster76 on Nov 18 2024
Jump to Answer
Comments
Post Details
Added on Nov 18 2024
3 comments
95 views