Number of bytes occupied by Chinese Characters in ORACLE Database

Source: Internet
Author: User

Before using the number of bytes for Chinese characters in the ORACLE database, I thought that one Chinese Character occupies two bytes. This is true for MSSQL Server (at least within my understanding. If there is an error, please correct it ). But recently I have been using the Oracle database and found some special things, that is, when you use two functions (length and lengthb respectively, what are these two functions used, I don't want to explain it. You can check it for help.) During the query, the result is that lengthb is three times the length (the premise is that the parameters in the length function are all Chinese characters ), this is strange. Isn't Chinese characters occupying two bytes? Why is it three here? So I found the information online. This is actually related to Oracle configuration and can be queried using the following statement:

1 SELECT * from v $ NLS_PARAMETERS t where t. PARAMETER = 'nls _ CHARACTERSET ';

 

You can query the character set of the current database. If value = ZHS16GBK, a Chinese character occupies 2 bytes. If value = AL32UTF8, a Chinese character occupies 3 bytes. After querying my database, the character set is AL32UTF8 (which is the default Character Set of the Oracle database ).

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.