Concatenation Operator (||) on Oracle SQL
Concatenation Operator
Topic Introduction: In this tutorial, today we will know what is Concatenation Operator and its use of this.
1. Concatenation Operator Links columns or character strings to other columns
2. Is represented by two vertical bars (||)
3. Creates a resultant column that is a character expression
SELECT first_name || last_name AS "Employee Name 1",first_name || ' ' || last_name AS "Employee Name 2"FROM employees;
In this picture, we see the employees' first names and last names shown in one column. Employee Name 1 without space and Employee Name 1 with a space. that is the full name of the employee.
Null Values with the Concatenation Operator
If we concatenate a null value with a character string, the result is a character string. last_name || null results will show only last_name.
Note: We can also concatenate date expressions with other expressions or columns. You can also use the CONCAT function for the same purpose.
No comments