Concatenating Strings with ||
Use the || (concatenation) operator to combine, or concatenate, strings. The || operator’s important characteristics are:
The || operator is two consecutive vertical-bar, or pipe, characters.
Concatenation doesn’t add a space between strings.
||, a dyadic operator, combines two strings into a single string: 'formal' || 'dehyde' is 'formaldehyde'.
You can chain concatenations to combine multiple strings into a single string: 'a' || 'b' || 'c' || 'd' is 'abcd'.
Concatenation with an empty string ('') leaves a string unchanged: 'a' || '' || 'b' is 'ab'.
The result of any concatenation operation that involves a null is null: 'a' || NULL || 'b' is NULL. (But see the Oracle exception in the DBMS Tip in this section.)
To concatenate ...
Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.