"Architecture, 13" Oracle's character set

Source: Internet
Author: User
Tags locale sqlplus

a simple understanding of the character set:Character set: The table that corresponds to the encoding of the character. When the software has a character set, it uses its own character set, and if the software does not have a character set, use the OS character set.
Two. Use of the character set: 1.oracle has two sets of characters: the database character set and the national character set. Both of these character sets are selected when the database is installed.            use of the database character set: (1) used to store char, VARCHAR2, CLOB, long and other types of data (2) to indicate such as table name, column name, and PL/SQL variable, etc. (3) used to store SQL and PL + + program units, etc. use of the national character set:(1) to store nchar, NVARCHAR2, NCLOB and other types of data



2. View the character set of the database:
Sql> select * from Nls_database_parameters;
PARAMETER VALUE----------------------------------------------------------------------nls_language               Americannls_territory americanls_currency $NLS _iso_currency Americanls_numeric_characters.,nls_characterset WE8ISO8859P1--database character SetNls_calendar Gregoriannls_date_format dd-mon-rrnls_date_language Americannls _sort Binarynls_time_format HH.MI. Ssxff AM
PARAMETER VALUE----------------------------------------------------------------------nls_timestamp_f ORMAT DD-MON-RR HH.MI. Ssxff Amnls_time_tz_format HH.MI. Ssxff AM Tzrnls_timestamp_tz_format dd-mon-rr hh.mi. Ssxff AM tzrnls_dual_currency $NLS _comp binarynls_length_semantics bytenls_nc HAR_CONV_EXCP FALSENls_nchar_characterset AL16UTF16--national character setNls_rdbms_version 10.2.0.1.0
Rows selected.
Three. Naming the character set:
Oracle's character set naming follows the following naming conventions: <language><bit size><encoding>: < languages >< bits >< encodings > For example: ZHS16GBK represents a common character set in the GBK encoding format, 16-bit (two-byte) Chinese character set: Us7ascii American characters zhs16cgb231280 Older Chinese character sets, used only for Chinese. Al32utf8 is the latest Unicode character set, more than the UTF8 character set. Generally selected asDatabase Character Set。 Af16utf16National Character SetUnified SelectionAf16utf16ZHS16GBK the newer Chinese character set,ZHS16GBKis azhs16cgb231280 A superset of the character set, but not strictly superset. Utf8
2. View all Oracle Character sets
SELECT * from V$nls_valid_values;
3. View the character set of the OS: linux:locale,locale-a windows:chcp
Four. Client OS character set, Nls_lang settings, server-side OS character set, Oracle database character set:
1. The client software Sqlplus does not have a character set and uses the operating system's character set. 2. If the software has a character set, the operating system character set fails. Therefore, Oracle does not use the operating system's character set. 3. All character set conversions are converted on the Oracle side. 4. Main process: Use Sqlplus to enter Chinese and encode Chinese using the operating system character set. And then upload it to Oracle. When Oracle's character set is inconsistent with the client's character set, Oracle converts the encoding into characters and then uses the database's character set to re-encode the characters and save them.5.oracle How to know the character set of the client:Oracle knows the client's character set through the Nls_lang parameter. Set the Nls_lang parameter on the client. Setting the client's character set: Set NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
6. How to set character sets:
①. The character set of the client operating system: Chinese, utf8.②.oracle character set: typically specified when the database is created. ③.client Nls_lang parameter settings: Be sure to match the character set of the client operating system .
Five. Settings for Nls_lang:Be sure to match the character set of the client operating system1. Format: nls_lang=<language>_<territory>.<client character set> language: Display Oracle message, checksum, date name Territ Ory: Specify default date, number, currency, and so on format client character set: Specifies the character set that the client will use for example: Nls_lang=american_america. Us7ascii American is the language, America is the region, Us7ascii is the client character set


Six. Example: View the character encoding of the data # Dump (name,1016): Indicates that the Name column is displayed directly in 16, and 10 indicates that the query results are displayedCharacterSet. Select ID, name, dump (name,1016) from T2; #查看你好的字符编码SQL > select dump (' Hello ', 1016) from Dual;dump (' Hello ',Ten)-----------------------------------------------typ=96 len=4CHARACTERSET=ZHS16GBK: C4,E3,BA,C3
#SQL > select dump (' hello ', +) from dual;
DUMP (' Hello ', typ=96)-------------------------len=4:c4,e3,ba,c3


"Architecture, 13" Oracle's character set

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.