New versions: Dev (3.15)

SPLIT_PART

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The SPLIT_PART() function splits a string into substrings and retrieves the nth part, starting from 1.

SELECT split_part('a,b,c', ',', 2);
create.select(splitPart(val("a,b,c"), ",", 2)).fetch();

The result being

+------------+
| split_part |
+------------+
| b          |
+------------+

Dialect support

This example using jOOQ:

splitPart(val("a,b,c"), ",", 2)

Translates to the following dialect specific expressions:

-- AURORA_POSTGRES, COCKROACHDB, POSTGRES, REDSHIFT, SNOWFLAKE, VERTICA
split_part('a,b,c', ',', 2)

-- BIGQUERY
split('a,b,c', ',')[ORDINAL(2)]

-- ACCESS, ASE, AURORA_MYSQL, DB2, DERBY, EXASOL, FIREBIRD, H2, HANA, HSQLDB, IGNITE, INFORMIX, MARIADB, MEMSQL, MYSQL, 
-- ORACLE, SQLDATAWAREHOUSE, SQLITE, SQLSERVER, SYBASE, TERADATA
/* UNSUPPORTED */

(These are currently generated with jOOQ 3.15, see #10141)

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo