Oracle data garbled solution

Problem Description

  When using PLSQL to insert Chinese, the data is garbled.

Insert image description here

Cause Analysis

The encoding used by the PLSQL client is inconsistent with the server-side encoding, and garbled characters will appear when inserting Chinese characters.

Solution

  View server-side encoding

select userenv('language') from dual;

Insert image description here
The actual result of the query is: AMERICAN_AMERICA.ZHS16GBK

   Look at the V$NLS_PARAMETERS item for NLS_LANGUAGE

select * from V$NLS_PARAMETERS WHERE PARAMETER = 'NLS_LANGUAGE

Insert image description here
Mine is AMERICAN which is inconsistent with the AMERICAN_AMERICA.ZHS16GBK in the first step. Environment variables need to be configured.

  PLSQL client computer sets environment variables

Computer->Properties->Advanced System Settings->Environment Variables->New
Set variable name: NLS_LANG, variable value: the value found in step 1, mine is AMERICAN_AMERICA.ZHS16GBK
Insert image description here

  RestartPLSQL

Insert image description here
Display is normal

Guess you like

Origin blog.csdn.net/slb190623/article/details/129867591