(Turn) oracle gets the string length functions length() and hengthb()

lengthb(string) Calculates the length in bytes occupied by string: returns the length of the string in bytes

length(string) Calculates the length of characters occupied by string: returns the length of the string in characters

 

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

For example, length('string')=lengthb('string') can be used to judge whether the string contains Chinese.

 

Note:

How many bytes a Chinese character occupies in the Oracle database is related to the character set of the database. In UTF8, the length is three.

 

select length('cctv') from dual ; query how many bytes Chinese characters occupy in the Oracle database

 
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326234076&siteId=291194637