---
title: "TO_ARRAY"
description: "La funci\u00F3n SQL TO_ARRAY divide un texto seg\u00FAn un separador en un array de textos."
language: es
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/es/docs/invantive-universalsql/grammar/sql-functions/to-array
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/to-array
updated: 2026-12-04T14:35:13Z
license: https://documentation.invantive.eu/es/
---

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

## Propósito
La función SQL `TO_ARRAY` divide un texto por un separador en una matriz de textos. Actualmente, la matriz resultante solo se puede utilizar con la función de tabla `INTERNETTABLE`, que acepta una matriz de textos en tres posiciones: las URL de inicio, las URL del mapa del sitio de la cláusula `sitemap` y las URL que se deben excluir de la cláusula `exclude`.

Véanse también [[SPLIT_PART]] y [[Internet Table (internetTableSpec)]].

Parámetros:
- Texto (`varchar2`): el texto que se va a dividir.
- Separador (opcional, `varchar2`): el separador que se utilizará para dividir el texto. El valor por defecto es `,`.

Devuelve: las partes del texto como una matriz de `varchar2`. Devuelve `null` cuando el texto es `null` o está vacío.

## Ejemplos
El siguiente ejemplo convierte un texto con tres URL separadas por `###` en una matriz de tres textos y recupera las páginas encontradas en dichas URL:
```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
```
El siguiente ejemplo convierte un texto con dos URL separadas por `,` (el separador por defecto) en una matriz y excluye estas URL de las páginas recuperadas:
```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
```

