Apache Hive : HPL/SQL - String Concatenation ||
Table of Contents
Apache Hive : HPL/SQL - String Concatenation ||
You can use || operator to concatenate two or more strings.
Syntax:
expr || expr [|| expr ...]
The result of the operation is always a string. If an operand is a number, it is implicitly converted to string before concatenation.
If an operand is NULL, it is treated as an empty string ’’ in the concatenation. If all operands are NULL, the result is NULL.
Examples:
| Concatenation | Result | Result Type |
|---|---|---|
‘a’ || ‘b’ || ‘c’ | ‘abc’ | String |
‘a’ || 1 || ‘c’ | ‘a1c’ | String |
‘a’ || NULL || ‘c’ | ‘ac’ | String |
NULL || NULL | NULL | String |
On-the-fly SQL Conversion
Hive does not support || operator, so HPL/SQL automatically converts in to CONCAT function in SQL SELECT statements.
Compatibility: Oracle, IBM DB2, Teradata, PostgreSQL and Netezza
See also: