TO_ARRAY
Sintassi
%%{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))
Scopo
La funzione SQL TO_ARRAY suddivide un testo in base a un separatore in un array di stringhe. L'array risultante può attualmente essere utilizzato esclusivamente con la funzione tabella INTERNETTABLE, che accetta un array di testi in tre posizioni: gli URL iniziali, gli URL della mappa del sito della clausola sitemap e gli URL da escludere della clausola exclude.
Vedi anche SPLIT_PART e Internet Table (internetTableSpec).
Parametri:
- Testo (
varchar2): il testo da suddividere. - Separatore (opzionale,
varchar2): il separatore in base al quale suddividere il testo. Il valore predefinito è,.
Restituisce: le parti del testo come array di varchar2. Restituisce null quando il testo è null o vuoto.
Esempi
L’esempio seguente converte un testo contenente tre URL separati da ### in un array di tre testi e recupera le pagine presenti a questi 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
L’esempio seguente converte un testo contenente due URL separati da , (il separatore predefinito) in un array ed esclude tali URL dalle pagine recuperate:
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