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 will demonstrate the 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()函数,它会返回什么?的详细内容。