Mysql和Oracle資料庫concat()函數,oracleconcat

來源:互聯網
上載者:User

Mysql和Oracle資料庫concat()函數,oracleconcat

一、函數的使用參數不同

Mysql支援多個字串拼接:

CONCAT(str1,str2,…) 

Oralce只支援兩個字串的拼接,若想拼接多個字串可以嵌套使用concat

   CONCAT(str1,str2) 

二、參數中有Null的處理方式不同

Mysql:返回結果為串連參數產生的字串。如有任何一個參數為NULL ,則返回值為 NULL。

Oralce:如有任何一個參數為NULL ,則返回值拼接後的字串。

三、其它方面

Mysql:如果所有參數均為非二進位字串,則結果為非二進位字串。 
如果自變數中含有任一二進位字串,則結果為一個二進位字串。

Oracle:如果CONCAT中串連的值不是字串,Oracle會嘗試將其轉換為字串

註:Oracle拼接字串還可以使用"||",當參數為Null時,返回值拼接後的字串。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.