40.21 SPLIT Function Signature 1

Use this function to split input string at separator.

Syntax

SPLIT (
    p_str   IN VARCHAR2,
    p_sep   IN VARCHAR2 DEFAULT apex_application.LF,
    p_limit IN PLS_INTEGER DEFAULT NULL )
    RETURN apex_t_varchar2;

Parameters

Table 40-23 SPLIT Function Signature 1 Parameters

Parameters Description

p_str

The input string.

p_sep

The separator. If null, split after each character. If a single character, split at this character. If more than 1 character, split at regular expression. The default is to split at line feed.

p_limit

Maximum number of splits, ignored if null. If smaller than the total possible number of splits, the last table element contains the rest.

Examples

apex_string.split(1||chr(10)||2||chr(10)||3)
-> apex_t_varchar2('1','2','3')

apex_string.split('1:2:3',':')
-> apex_t_varchar2('1','2','3')

apex_string.split('123',null)
-> apex_t_varchar2('1','2','3')

apex_string.split('1:2:3:4',':',2)
-> apex_t_varchar2('1','2:3:4')

apex_string.split('key1=val1, key2=val2','\s*[=,]\s*')
-> apex_t_varchar2('key1','val1','key2','val2')