首頁 >資料庫 >mysql教程 >如果我將NULL提供給MySQL的CHAR_LENGTH()函數,它會回傳什麼?

如果我將NULL提供給MySQL的CHAR_LENGTH()函數,它會回傳什麼?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB轉載
2023-08-23 16:54:481082瀏覽

如果我將NULL提供給MySQL的CHAR_LENGTH()函數,它會回傳什麼?

In this case, the output of CHAR_LENGTH() function depends on the condition that whether we are providing NULL as a string or we are providing simply NULL to it. Following example or we are providing simply NULL to it. Following example or we are providing simply NULL to it. Following example or we 是difference −

mysql> Select CHAR_LENGTH(NULL);
+-------------------+
| CHAR_LENGTH(NULL) |
+-------------------+
| NULL              |
+-------------------+
1 row in set (0.00 sec)

mysql> Select CHAR_LENGTH('NULL');
+---------------------+
| CHAR_LENGTH('NULL') |
+---------------------+
| 4                   |
+---------------------+
1 row in set (0.00 sec)

從上面的結果集中可以觀察到,當我們將NULL作為字串提供時,CHAR_LENGTH()函數將傳回字元的數量,即4個字符,否則當我們只提供NULL時,它將返回NULL作為輸出。

以上是如果我將NULL提供給MySQL的CHAR_LENGTH()函數,它會回傳什麼?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除