カンマ区切りの文字列を分解する [postgres]

カンマ区切りの文字列をレコードにする関数があります。

regexp_split_to_table関数

regexp_split_to_table(文字列, 区切文字)


-- regexp_split_to_table関数
select regexp_split_to_table('1,2,3,4,5,6,7,8,9,10', ',') as number
 
を実行すると

結果

number(text)
-------------------------------------------
1
2
3
4
5
6
7
8
9
10

となります。
色々と便利な関数です。

コメント

人気の投稿