Oracle data garbled solution
Problem Description
When using PLSQL to insert Chinese, the data is garbled.
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;
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
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
RestartPLSQL
Display is normal