Similar to other database systems, Oracle string concatenation uses the "| |" string concatenation, which is used in the same way as the plus sign "+" in MSSQLServer.
For example, execute the following SQL statement:
Copy Code code as follows:
SELECT ' work # for ' | | fnumber| | ' The employee's name is ' | | FName from T_employee
WHERE FName is not NULL
In addition to "| |", Oracle also supports string concatenation using the concat () function, such as executing the following SQL statement:
SELECT CONCAT (' Work No.: ', Fnumber) from T_employee
If the value of the connection in Concat is not a string, Oracle attempts to convert it to a string, such as executing the following SQL statement:
SELECT CONCAT (' Age: ', Fage) from T_employee
Unlike the MySQL concat () function, Oracle's CONCAT () function supports only two parameters and does not support stitching of more than two strings, for example, the following SQL statement is incorrect in Oracle:
SELECT CONCAT (' Work number is ', Fnumber, ' Employee name is ', FName ') from T_employee
WHERE FName is not NULL
Oracle will report the following error message after running:
Invalid number of arguments
If you want to stitch multiple strings, you can use multiple concat () functions that can be nested using the following SQL to overwrite:
Copy Code code as follows:
SELECT CONCAT (CONCAT CONCAT (' Work number ', Fnumber), ' Employee Name '), FName from
T_employee
WHERE FName is not NULL