当前位置:网站首页>Maxcompute string splitting function -split_ PART
Maxcompute string splitting function -split_ PART
2022-07-03 08:00:00 【The dawn of victory】
Grammar format
string split_part(string <str>, string <separator>, bigint <start>[, bigint <end>])
Function description
According to the separator separator Split string str, Return from start Part to end Substring of part ( Closed interval ).
Parameter description
- str: Required .STRING type . The string to be split . If it is BIGINT、DOUBLE、DECIMAL or DATETIME type , Will be implicitly converted to STRING Participate in the operation after type .
- separator: Required .STRING Type constant . Separator for splitting , It can be a character , It can also be a string .
- start: Required .BIGINT Type constant , Must be greater than 0. Indicates the start number of the returned segment ( from 1 Start ).
- end:BIGINT Type constant , Greater than or equal to start. Indicates the end number of the returned segment , Omission , By default, it means and start The values are equal , return start Specified segment .
Return value description
return STRING type . The return rule is as follows :
- If start The value of is greater than the actual number of segments after segmentation , For example, there is 6 A fragment ,start Greater than 6, Return to empty string .
- If separator There is no in str in , And start Designated as 1, Back to the whole str. If str For the empty string , Then an empty string is output .
- If separator For the empty string , Return the original string str.
- If end Greater than the number of fragments , Return from start The starting substring .
- str Not STRING、BIGINT、DOUBLE、DECIMAL or DATETIME Type , Return error .
- separator Not STRING Type constant , Return error .
- start or end Not BIGINT Type constant , Return error .
- except separator Outside , If any parameter value is NULL, return NULL.
Examples of use
Example 1: According to the separator , Split string a,b,c,d, Returns the substring of the specified part . An example command is as follows .
-- return a.
select split_part('a,b,c,d', ',', 1);
-- return a,b.
select split_part('a,b,c,d', ',', 1, 2);
Example 2:start The value of is greater than the actual number of segments after segmentation . An example command is as follows .
-- Return to empty string .
select split_part('a,b,c,d', ',', 10);
Example 3:separator There is no in str in . An example command is as follows .
-- return a,b,c,d.
select split_part('a,b,c,d', ':', 1);
-- Return to empty string .
select split_part('a,b,c,d', ':', 2);
Example 4:separator For the empty string . An example command is as follows .
-- return a,b,c,d.
select split_part('a,b,c,d', '', 1);
Example 5:end The value of is greater than the actual number of segments after segmentation . An example command is as follows .
-- return b,c,d.
select split_part('a,b,c,d', ',', 2, 6);
Example 6: except separator Outside , Any input parameter is NULL. An example command is as follows .
-- return NULL.
select split_part('a,b,c,d', ',', null);
边栏推荐
- C language learning notes (mind map)
- C2 several methods of merging VCF files
- P2622 关灯问题II(状态压缩 搜索)
- Luaframwrok handles resource updates
- IP production stream is so close to me
- VMware virtual machine configuration static IP
- I want to do large screen data visualization application feature analysis
- *p++、*++p、++*p、(*p)++
- register关键字
- [MySQL 13] if you change your password for the first time after installing mysql, you can skip MySQL password verification to log in
猜你喜欢

IP production stream is so close to me

Pat class a 1030 travel plan

Open the influence list of "National Meteorological Short Videos (Kwai, Tiktok) in November" in an interactive way“

Pat grade a 1029 median
![[MySQL 12] MySQL 8.0.18 reinitialization](/img/e1/9874df18bbc8d80c3c5c5fe39aefc9.png)
[MySQL 12] MySQL 8.0.18 reinitialization

Redis批量启停脚本

PostGIS space function

Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does

oracle 插入单引号

Ventuz Foundation Series "one step at the door"
随机推荐
oracle中的 (+)是什么意思
[MySQL 13] if you change your password for the first time after installing mysql, you can skip MySQL password verification to log in
C language learning notes (mind map)
MAE
LwIP learning socket (API)
Uniapp learning records
华为S5700交换机初始化和配置telnet,ssh用户方法
My touch screen production "brief history" 2
一条通往服务器所有端口的隧道
*p++、*++p、++*p、(*p)++
Lua framwrok framework starts
PHP wechat red packet grabbing algorithm
The general trend of data news releases the power of visual reporting ----- essays after reading
Ventuz Foundation Series "one step at the door"
Generate video using clipout in viz engine
什麼是定義?什麼是聲明?它們有何區別?
Redis batch startup and shutdown script
MaxCompute字符串分割函数-SPLIT_PART
oracle 插入单引号
【LeetCode】3. Merge two sorted lists · merge two ordered linked lists