'桌面£º'abc:voip●以Col1开始
当我在雪花中运行下面的查询时,第二个\u值的值显示为空,而不是空值。如何获取此示例数据的空值
select 'Desktop::abc:voip::GET STARTED' as Col1 split_part($1:Col1 :: String, ':', 1) as First_Value, split_part($1:Col1 :: String, ':', 2) as Second_Value, split_part($1:Col1 :: String, ':', 3) as Third_Value, split_part($1:Col1 :: String, ':', 4) as Fourth_Value;
输出如下
可以使用NULLIF()将长度为零的字符串强制为null。例如:
select 'Desktop::abc:voip::GET STARTED' as Col1, NULLiF(split_part(Col1 :: String, ':', 1),'') as First_Value, NULLiF(split_part(Col1 :: String, ':', 2),'') as Second_Value, NULLiF(split_part(Col1 :: String, ':', 3),'') as Third_Value, NULLiF(split_part(Col1 :: String, ':', 4),'') as Fourth_Value