Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use length () and hengthb () functions to calculate string length in oracle

Shulou Source: shulou.com Published: 2022-05-31 21:20:51 11月15日 Update

Today, I will talk to you about how to use the length () and hengthb () functions to calculate the string length in oracle. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Lengthb (string) calculates the length of bytes occupied by string: returns the length of the string in bytes

Length (string) calculates the character length occupied by string: returns the length of the string in characters

For single-byte characters, LENGTHB and LENGTH are the same.

For example, you can use length ('string') = lengthb (' string') to determine whether the string contains Chinese.

Note:

The number of bytes of a Chinese character in the Oracle database is related to the character set of the database. When UTF8, the length is three.

Select lengthb (gone with the Wind) from dual can query the number of bytes of Chinese characters in the Oracle database

After reading the above, do you have any further understanding of how to use the length () and hengthb () functions in oracle to find the length of a string? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Character length string byte content data database function unit Chinese character related character set more knowledge article industry information information channel channel Chinese Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Docker MariaDB macOS Shulou Technology