- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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)
Advertisements