連線運算子或 concat() 函式

Oracle SQL 和 PL / SQL ||運算子允許你將兩個或多個字串連線在一起。

例:

假設以下 customers 表:

 id  firstname    lastname
---  -----------  ----------
  1  Thomas       Woody

查詢:

 SELECT firstname || ' ' || lastname || ' is in my database.' as "My Sentence" 
   FROM customers;

輸出:

My SentenceThomas Woody is in my database.

Oracle 還支援標準的 SQL CONCAT(str1, str2) 功能:

例:

查詢:

 SELECT CONCAT(firstname, ' is in my database.') from customers;

輸出:

Expr1Thomas is in my database.