Split String Function in MySQL

I saw a question about how to split delimited string in MySQL. MySQL does not include a function to split a delimited string. So I decided to write a simple one:

When we call this function as SPLIT( ‘ali,ahmet,mehmet’, ‘,’, 3 ), we get the 3rd item “mehmet”. If we call this function as SPLIT( ‘ali,ahmet,mehmet’, ‘,’, 5 ), it will return an empty string.

Please share

AWS Big Data Specialist. Oracle Certified Professional (OCP) for EBS R12, Oracle 10g and 11g. Co-author of "Expert Oracle Enterprise Manager 12c" book published by Apress. Awarded as Oracle ACE (in 2011) and Oracle ACE Director (in 2016) for the continuous contributions to the Oracle users community. Founding member, and vice president of Turkish Oracle User Group (TROUG). Presented at various international conferences including Oracle Open World.


  1. mahesh singh


    i have string and i want to split that into string array . I don’t want to use third parameter can i do that without it or how can i do that?

    suppose that my input is ¬†‘my name is abc’ and i want to split this string using ¬†space(i.e. ‘ ‘) and my output comes that i get each word (my,name,is,abc) and then i want each elements in that array want to compare with another string please let me know how can i do that?

Leave Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.