Oracle Database case study-garbled characters are displayed in the database after Chinese characters are inserted using SQL statements.

Source: Internet
Author: User

1.1 symptom description when the following SQL statement is imported, garbled characters are displayed in the database.

Insert into CONFERENCE (values, values, ACCESSNUMBER, ACCOUNTID, ALLOCATEDID, ALLOWVIDEOCONTROL, SCREENTYPE, values, BOARDNUM, CANRECORD, CHARGEMODE, values, CYCLETYPE, ENDTIME, ENTERPROMPT, FACTENDTIME, LANGUAGE, delimiter, LENGTH, LOCKSTATE, MEDIATYPES, MEMBERNOTIFY, MEMO, delimiter, delimiter, needautokind, NEEDAUTORECORD, delimiter, delimiter, ORGANIZATIONID, identifier, permitkincord, PERMITRECORD, REALORGANIZATIONID, REASON, Snapshot, RESERVESIZE, SCHEDULENOTIFY, SCHEDUSERMOBILE, SCHEDUSERNAME, CONFERENCESIZE, SPEAKSTATE, STARTTIME, SUBJECT, SUMMERTIME, TIMEZONE, UPDATENOTIFY, values, EXT1, EXT2, EXT3) values ', 2, '123', '1', 16, 0, '','', '123', 0, 'schedule', 'common', 'schedule', 'schedule ', 'cycle', 1238251500000, '', 1238251500000, 'zh _ cn','', 840, '', 'video', 1, 'toporganization', 20090328, 1, 'toporganization', 0, '2017/meet0000152972 ', 1238201100000, '','', 'periodic videoconferencing, 1, 'unrecord', '20170101', 'unrecord', null, null );
1.2 The reason may be that the inserted SQL statement contains Chinese characters. Because the character set of the database is different from the character set of the operating system, garbled characters are displayed in the database. 1.3 Procedure OracleThe machine on which the user logs on to the database. To SysdbaThe user connects to the database.

% Sqlplus/as sysdba

Check the value of the database character set parameter "NLS_LANGUAGE.

SQL> select value from nls_database_parameters where parameter = 'nls _ LANGUAGE ';

The displayed parameter value is "AMERICAN ".

VALUE
--------------------------------------------------------------------------------
AMERICAN
Check the value of the database character set parameter "NLS_TERRITORY.

SQL> select value from nls_database_parameters where parameter = 'nls _ TERRITORY ';

The displayed parameter value is "AMERICA ".

VALUE
--------------------------------------------------------------------------------
AMERICA
Check the value of the database character set parameter "NLS_CHARACTERSET.

SQL> select value from nls_database_parameters where parameter = 'nls _ CHARACTERSET ';

The displayed parameter value is WE8MSWIN1252 ".

VALUE
--------------------------------------------------------------------------------
WE8MSWIN1252
Modify the character set "NLS_LANG" variable of the operating system of the database Machine Based on the character set parameters queried in the database.

SQL> export NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252

"AMERICAN", "AMERICA", and "WE8MSWIN1252" are the query results of 3, 4, and 5.

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.