Oracle的CONCAT函数用于将两个或多个字符串连接在一起
SELECT CONCAT(CONCAT(first_name, ' '), last_name) AS full_name
FROM employees;
SELECT first_name || ' ' || last_name AS full_name
FROM employees;
SELECT employee_id || ': ' || first_name || ' ' || last_name AS employee_info
FROM employees;
SELECT CONCAT(first_name, CASE WHEN department_id = 10 THEN ' (HR)' ELSE '' END) AS employee_name
FROM employees;
SELECT LISTAGG(first_name || ' ' || last_name, ', ') WITHIN GROUP (ORDER BY hire_date) AS employee_names
FROM employees;
SELECT first_name || ', ' || last_name AS full_name
FROM employees;
这些高级用法展示了如何在Oracle中灵活地使用CONCAT函数和||运算符来连接字符串。