Character Set Overview

Source: Internet
Author: User

Character Set Overview
A brief overview of the oracle031 Character Set: A character set corresponds to the encoding. 1. Functions and meanings of character sets
Character encoding
Usage
Database Character Set
(1) used to store CHAR, VARCHAR2, CLOB, LONG, and other data types
(2) used to mark table names, column names, PL/SQL variables, etc.
(3) used to store SQL and PL/SQL program units
National Character Set
(1) used to store NCHAR, NVARCHAR2, NCLOB, and other data types
2. Client OS Character Set, NLS_LANG setting, Server OS character set, and Oracle Database Character Set
Relationship between character sets
Set character set correctly
3. Judging process after a character set problem occurs
Stores incorrect character encoding.
The storage is correct character encoding
4. locale, locale-a, and chcp

5. Character Set naming
The character set naming rules of Oracle follow the following naming rules:
<Language> <bit size> <encoding>
Namely: <language> <bit number> <encoding>
For example, ZHS16GBK indicates that the GBK encoding format and 16-bit (two-byte) simplified Chinese character set are used.

US7ASCII // the character set selected by the Americans. It can only contain no more than 128 characters in the United States.
Zhs16cgb231280 // Chinese Character Set, which stores some Chinese Characters
AL32UTF8 // oracle Database Character Set
AF16UTF16 // select the country character set for oracle
ZHS16GBK // the character set used in China. It contains all Chinese characters and is a superset of zhs16chb231280, not a strict superset utf8 //

Superset strict superset

NLS_LANG = <language >_< territory>. <client character set>
Language: displays the oracle message, validation, and date name.
Territory: Specifies the default date, number, currency, and other formats
Client character set: Specifies the character set that the Client will use
Example: NLS_LANG = AMERICAN_AMERICA.US7ASCII
After logging on to the database, the database prompts that the language is not character encoding. AMERICA indicates that the information displayed in different regions is different, such as time zone and currency; US7ASCII is the client Character Set
Oracle provides several NLS parameter customization databases and user machines to adapt to local formats, such as NLS_LANGUAGE, NLS_DATE_FORMAT, and NLS_CALENDER. You can query the following data dictionary or view in v $ view.
NLS_DATABASE_PARAMETERS -- displays the current NLS parameter values of the database, including the database character set values
NLS_SESSION_PARAMETERS -- display the parameters set by NLS_LANG or the parameter values changed by alter session (excluding the client Character Set set by NLS_LANG)
NLS_INSTANCE_PARAMETE -- display the parameter V $ NLS_PARAMETERS defined by the parameter file init <SID>. ora -- display the value of the current NLS parameter of the database


Select * from nls_session_parameters

NLS_LANGUAGE SIMPLIFIED CHINESE
NLS_TERRITORY CHINA
NLS_CURRENCY $
NLS_ISO_CURRENCY CHINA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE SIMPLIFIED CHINESE
NLS_SORT BINARY
NLS_TIME_FORMAT HH. MI. SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH. MI. SSXFF AM
NLS_TIME_TZ_FORMAT HH. MI. SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH. MI. SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE

Select * from nls_database_parameters
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET ZHS16GBK
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH. MI. SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH. MI. SSXFF AM
NLS_TIME_TZ_FORMAT HH. MI. SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH. MI. SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 11.2.0.1.0

Select userenv ('language') from dual; // query
USERENV ('language ')
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK

Select nls_charset_name (to_number ('20140901', 'xxxxx') from dual;

NLS_CHARSET_NAME (TO_NUMBER ('20140901', 'xxxxx'
----------------------------------------
ZHS16GBK

Echo $ NLS_LANG

SQL>! Echo $ NLS_LANG
American_america.zhs16gbk

Select to_char (nls_charset_id ('zhs16gbk'), 'xxx') from dual;

TO_CH
-----
354

SQL>

Select dump ('abc', 1016) from dual;
DUMP ('abc ', 1016)
--------------------------------------------
Typ = 96 Len = 3 CharacterSet = ZHS16GBK: 61,62, 63

SQL>

Select * from V $ NLS_VALID_VALUES; // This view lists all valid values for NLS parameters.

If the software has a character set, the system's character set will become invalid. If the software does not have a character set, the operating system's character set will be used for a long time.
Oracle converts all character sets in oracle. oracle converts all character sets in oracle. oracle stores the character sets in warp knitting numbers. oracle stores the encoding format in oracle databases. oracle stores the character sets before encoding. what encoding is used, if they are the same, they will be stored directly. If they are different, they will be transcoded and the client will only encode them.
The NLS_LANG parameter must be consistent with the character set of the client operating system. NLS_LANG is equivalent to SQL developer and sqlplus dealing with oracle, which have no character set.









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.