§ SQL兼容性 - LENGTHB()函数


§ 1. 语法

LENGTHB(string)
1

§ 2. 定义和用法

LENGTHB() 函数相当于内建LENGTH()函数的别名,会传回储存string所需的字节数。

§ 3. 示例

-- 注意,这里把 -123 和 123.5555 当做字符串类型
greatsql> SELECT LENGTHB(-123), LENGTHB(123.5555);
+---------------+-------------------+
| LENGTHB(-123) | LENGTHB(123.5555) |
+---------------+-------------------+
|             4 |                 8 |
+---------------+-------------------+

greatsql> SELECT LENGTHB(DATE '2023-05-26');
+----------------------------+
| LENGTHB(DATE '2023-05-26') |
+----------------------------+
|                         10 |
+----------------------------+

greatsql> SELECT LENGTHB(1.2E+9),1.2E+9;
+-----------------+------------+
| LENGTHB(1.2E+9) | 1.2E+9     |
+-----------------+------------+
|              10 | 1200000000 |
+-----------------+------------+

greatsql> SELECT LENGTHB( _UTF8MB4 'GreatSQL数据库');
+----------------------------------------+
| LENGTHB( _UTF8MB4 'GreatSQL数据库')    |
+----------------------------------------+
|                                     17 |
+----------------------------------------+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

§ 问题反馈

§ 联系我们

扫码关注微信公众号

greatsql-wx