---
title: "TO_ARRAY"
description: "The TO_ARRAY SQL function splits a text on a separator into an array of texts."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/to-array
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/to-array
updated: 2026-08-09T00:00:00Z
license: https://documentation.invantive.eu/en/
---

## 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
```