lengthb
This function is used to return the length of a specified string in bytes.
Similar function: length. The length function is used to return the length of a string and return a value of the BIGINT type.
Syntax
lengthb(string <str>)
Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
str |
Yes |
STRING |
Input string |
Return Values
The return value is of the STRING type.
![](https://support.huaweicloud.com/intl/en-us/sqlreference-dli/public_sys-resources/note_3.0-en-us.png)
- If the value of str is not of the STRING, BIGINT, DOUBLE, DECIMAL, or DATETIME type, an error is reported.
- If the value of str is NULL, NULL is returned.
Example Code
The value 5 is returned.
select lengthb('hello');
The value NULL is returned.
select lengthb(null);
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot