TO_ARRAY
構文
%%{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))
目的
TO_ARRAY SQL関数は、区切り文字でテキストを分割し、テキストの配列を作成します。 結果の配列は現在、INTERNETTABLEテーブル関数でのみ使用できます。この関数は、3つの位置でテキストの配列を受け付けます。開始URL、sitemap句のサイトマップURL、exclude句で除外するURLです。
関連項目:SPLIT_PARTおよびInternet Table (internetTableSpec)。
パラメータ:
- テキスト(
varchar2):分割するテキスト。 - 区切り文字(省略可、
varchar2):テキストを分割する区切り文字。 既定値は,です。
戻り値:テキストの各部分をvarchar2の配列として返します。 テキストがnullまたは空の場合、nullを返します。
例
次の例では、###で区切られた3つのURLを含むテキストを3つのテキストの配列に変換し、これらの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
次の例では、2つのURL(デフォルトの区切り文字,で区切られた)を含むテキストを配列に変換し、取得したページからこれらのURLを除外します:
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