concat
我正在尝试用concat操作符连接表中的字符串列||并抛出错误。
Here is the query: select "Bob"||'~'||"glad" from table
its throwing error as : ParseException - cannpt recognize input near '|' '"~"' '|' in expression specification
可用于concat函数,但不能用于concat操作符。
select concat("bob","~","glad") from table - its working
我正在使用hive版本2.1,谁能告诉我为什么这个操作符不工作?
谢谢,先生
Hive不支持连接操作符||
,它的oracle语法。请使用concat
函数连接多个值。您可以使用concat_ws
与分隔符连接。
concat
select concat ('this','~','is','~','hello','~','world');
Output : this~is~hello~world
select concat_ws ('~','hello','world','is','not','enough');
Output : hello~world~is~not~enough