The DB2 string connection is the same as that of the oracle database. The DB2 string connection is performed using "|", which is the same as the plus sign "+" in MSSQLServer. For example, execute the following SQL statement:
SELECT 'employee ID is '| FNumber |' employee name is '| FName FROM T_Employee
WHERE FName IS NOT NULL
In addition to "|", DB2 also supports String concatenation using the CONCAT () function, such as executing the following SQL statement:
Select concat ('employee ID: ', FNumber) FROM T_Employee
Unlike Oracle, if the connected value in CONCAT is not a string, DB2 will not try to type conversion but report an error message. For example, the following SQL statement is incorrect:
Select concat ('Age: ', FAge) FROM T_Employee
After running DB2, the following error message is returned:
No authorized instance with compatible independent variables named "FUNCTION" CONCAT "is found
Unlike MYSQL's CONCAT () function, DB2's CONCAT () function only supports two parameters and does not support concatenation of two or more strings. For example, the following SQL statement is incorrect in Oracle:
Select concat ('employee ID is ', FNumber,' employee name is ', FName) FROM T_Employee
WHERE FName IS NOT NULL
After running Oracle, the following error message is displayed:
Authorization routines with compatible independent variables named "FUNCTION" CONCAT "not found
To splice multiple strings, you can use multiple CONCAT () functions for nesting. The preceding SQL statement can be rewritten as follows:
Select concat ('employee ID is ', FNumber),' employee name is '), FName) FROM
T_Employee
WHERE FName IS NOT NULL
DB2 update statements for records in the same table
How to expand the tablespace and Field Length in db2
DB2 strings in DB2 Databases
Policy Selection for DB2 environment variable Management
Management tasks that can be completed by the DB2 Management Server