我的专栏有以下数据:(这是一个例子,真正的一行有100万行)
输入:
NumberID
17.843.983-9
8.365.938-1
10.294.487-5
我需要删除两个'。'从字符串。预期专栏:
预期输出:
NumberID
17843983-9
8365938-1
10294487-5
我尝试使用substr和regexp替换,但我似乎无法找到正确的方法。
答案 0 :(得分:0)
hive> with t as (select stack(3,'17.843.983-9','8.365.938-1','10.294.487-5') as col)
> select regexp_replace(col,'\\.','')
> from t
> ;
OK
_c0
17843983-9
8365938-1
10294487-5
或
hive> with t as (select stack(3,'17.843.983-9','8.365.938-1','10.294.487-5') as col)
> select replace(col,'.','')
> from t
> ;
OK
_c0
17843983-9
8365938-1
10294487-5