TO_ARRAY
Sintaxis
%%{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:
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:
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