An issue with the number of bytes occupied by Oracle Kanji

Source: Internet
Author: User

one character in Oracle, especially Chinese characters, takes up a few bytes in relation to a character set. For example GBK, Chinese characters will account for two bytes, English one, if it is UTF-8, Chinese characters generally accounted for 3 bytes, English or 1. However, in general, we consider two bytes processing, because the Oracle installation by default we all choose GBK encoding format, But when we check the length of the input string on the page, the maximum length of the database design field is the maximum length-----prevent the database from being migrated with different encoding format.
View the number of characters the string occupies: Select Length (' 12 Chinese ') from dual;   --4 View the number of bytes occupied by the string: Select LENGTHB (' 12 Chinese ') from dual;     --8 Nvarchar2 is a kanji character that occupies two bytes, regardless of the character set: Select Length (N ' Zhonghua 1 ') from dual;   --3 Select LENGTHB (N ' Zhonghua 1 ') from dual;    --6 Supplement: (1) Query Character Set statement: Select Userenv (' language ') from dual; (Simplified Chinese_china. AL32UTF8) query results are divided into three parts: Nls_lang = Language_territory.charset It has three components (language, geography, and character set), Where: language Specifies the language of the server message, territory Specifies the date and number format for the server, CharSet specifies the character set. (2) How to view Oracle's character set, date format, language, etc.?    Sys>show parameter NLS;   -No specific comprehensive valuesys>select * from Nls_database_parameter; The--nls_database_parameter table is the most detailed.

An issue with the number of bytes occupied by Oracle Kanji

Related Article

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.