Oracle的 CONCAT 函數用于將兩個或多個字符串連接在一起
SELECT CONCAT(first_name, last_name) AS full_name
FROM employees;
SELECT CONCAT(CONCAT(first_name, ' '), last_name) AS full_name
FROM employees;
SELECT CONCAT(CONCAT(first_name, ' - '), last_name) AS full_name
FROM employees;
SELECT CONCAT(UPPER(first_name), ' ', UPPER(last_name)) AS upper_full_name
FROM employees;
SELECT CONCAT(first_name, CASE WHEN job_id = 'IT_PROG' THEN ' - Programmer' ELSE '' END) AS title_name
FROM employees;
通過這些示例,您可以了解如何在實際查詢中靈活運用 Oracle 的 CONCAT 函數。請注意,這里的示例是基于 Oracle 數據庫的 EMPLOYEES 表,您可能需要根據您的實際數據表進行調整。