BIT_LENGTH()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the length of a string in bits.
USAGE
BIT_LENGTH(string)
Argument Name | Description |
---|---|
| The string to evaluate |
DETAILS
BIT_LENGTH()
is a string function that returns the length of the string in bits.
A number is converted into a string before being measured.
The return value is equivalent to CHAR_LENGTH(string)*8
.
A 0
is returned if the argument is an empty string (without any whitespace).
A NULL
is returned if the argument is NULL
.
EXAMPLES
SELECT BIT_LENGTH('foobar'), BIT_LENGTH(-1);
+----------------------+----------------+
| BIT_LENGTH('foobar') | BIT_LENGTH(-1) |
+----------------------+----------------+
| 48 | 16 |
+----------------------+----------------+
+------------------+
| BIT_LENGTH(NULL) |
+------------------+
| NULL |
+------------------+