## Syntax ```mermaid %%{init: { 'theme': 'base', 'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' }, 'themeVariables': { 'fontSize': '11px', 'fontFamily': 'Arial' } }}%% flowchart LR Start((START)) --> TO_ARRAY[TO_ARRAY]:::quoted TO_ARRAY --> End((END)) ``` ## Purpose The `TO_ARRAY` SQL function splits a text on a separator into an array of texts. The resulting array can currently solely be used with the `INTERNETTABLE` table function, which accepts an array of texts in three positions: the starting URLs, the sitemap URLs of the `sitemap` clause and the URLs to exclude of the `exclude` clause. See also [[SPLIT_PART]] and [[Internet Table (internetTableSpec)]]. Parameters: - Text (`varchar2`): the text to split. - Separator (optional, `varchar2`): the separator to split the text on. Defaults to `,`. Returns: the parts of the text as an array of `varchar2`. Returns `null` when the text is `null` or empty. ## Examples The following example converts a text with three URLs separated by `###` into an array of three texts and retrieves the pages found on these URLs: ```sql select t.* from internettable ( to_array ( 'https://cloud.invantive.com' || '###https://cloud.invantive.com/language/nl' || '###https://cloud.invantive.com/language/en' , '###' ) sitemap 'https://cloud.invantive.com/sitemap.xml' max depth 2 ) t limit 10 ``` The following example converts a text with two URLs separated by `,` (the default separator) into an array and excludes these URLs from the pages retrieved: ```sql select t.* from internettable ( 'https://invantive.com' sitemap 'https://www.invantive.com/sitemap.xml' exclude to_array('https://invantive.com/privacy/index.html,https://invantive.com/products/index.html') stay on site max depth 1 ) t limit 10 ```