Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

PostgreSQL SPLIT_PART() function

SPLIT_PART() function

The PostgreSQL split_part function is used to split a given string based on a delimiter and pick out the desired field from the string, start from the left of the string.

Syntax:

split_part(<string>,<delimiter>, <field_number>)

PostgreSQL Version: 9.3

Pictorial Presentation of PostgreSQL SPLIT_PART() function

Pictorial presentation of postgresql split_part function

Example: PostgreSQL SPLIT_PART() function :

In the example below, the delimiter of the defined string is '-#-' and specified field number is 2. So the split_part function splits the second field from the specified string.

SELECT split_part('ordno-#-orddt-#-ordamt', '-#-', 2);

Sample Output:

 split_part
------------
 orddt
(1 row)

Previous: RTRIM function
Next: STRPOS function