Length, lengthb, lengthc, leng2, length4!

Source: Internet
Author: User

The details are as follows:
Length (string1) returns the length in characters.
Lengthb (string1) returns the length in bytes.
Lengthc (string1) returns the length in units of Unicode full characters.
Leng22 (string1) returnsCodeThe length of a vertex.
Length4 (string1) returns the length in the unit of ucs4 code points.

Lengthb may have different values in different databases.
For example, the value of lengthb ('har') in different databases may be 2 or 3.

 

Because different character sets have different Chinese characters,
For example, zhs16gbk is a two-digit string that uses two bytes to define a Chinese character.
In utf8, three bytes are used. (There is also the possibility of utf8 with 2 Chinese characters)
In short, the value of lengthb is related to the character set of your current database.
The biggest difference between length () and lengthb () in Oracle is:
SQL> select length ('Happy New Year') from dual;

Length ('Happy New Year ')
------------------
4

SQL> select lengthb ('Happy New Year') from dual;

Lengthb ('Happy New Year ')
-------------------
8

Difference: length is the length of a character,
The length of lengthb is measured in bytes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.