How can we pass an empty string as a parameter to BIT_LENGTH() function and what would be returned by MySQL?


Whenever we want to pass an empty string as a parameter to BIT_LENGTH() function then we must have to pass blank quotes (even without any space). It cannot pass without quotes because MySQL then resembles it as the function without any argument and returns an error. But, when we pass an empty string with blank quotes then MySQL will return 0 as output. It can be understood with the following example as well −

Example

mysql> Select BIT_LENGTH();
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'BIT_LENGTH'

mysql> Select BIT_LENGTH('');
+----------------+
| BIT_LENGTH('') |
+----------------+
| 0              |
+----------------+
1 row in set (0.00 sec)

Updated on: 20-Jun-2020

166 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements