Skip to Main Content

Database Software

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.

a string splitting function like SPLIT_PART in postgres

Martin PreissFeb 23 2015 — edited Jan 11 2016

In postgres there is a simple string function SPLIT_PART to get the n-th part of a given string that is splitted on defined delimiters. A simple example would be:

SELECT SPLIT_PART('A,B,C,D', ',', 2);

split_part

-----------

B

So the function takes an input string, splits it at the given delimiter and returns the n-th substring.

Of course it is not a very complex task to get this functionality in Oracle (using a combination of instr, substr; maybe embetted in a user-defined function) - but I think it would be nice to get this task done with a single built-in function. This would make some common csv-import tasks very convenient.

As Frank Kulash mentioned in his comment: an (optional) enclosing character would make such a function even more valuable.

Comments

Post Details

Added on Feb 23 2015
14 comments
25,148 views