Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if sqlplus displays garbled codes?

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you the "sqlplus display garbled code how to do", the content is easy to understand, clear, hope to help you solve the doubt, the following let the editor lead you to study and learn "sqlplus display garbled how to do" this article.

1. Phenomenon

Recently, when using the new oracle environment, it was found that the code was garbled when logging in through sqlplus.

2. Solution

Through consulting the data, it is found that the sqlplus garbled code is related to the environment variable NLS_LANG in the operating system user. If this is not consistent with the database character set, it will produce garbled code. Adhere to the NLS_LANG environment variable found that this variable is not set at all, it should be read the operating system character set as the default character set.

[oracle@localhost ~] $echo $NLS_LANG

[oracle@localhost ~] $

How to view the database character set? through the nls_database_parameters query, we can get that the value of NLS_CHARACTERSET is UTF8, that is, the database character set.

SQL > col parameter for A30

SQL > col value for A25

SQL > select * from nls_database_parameters

PARAMETER VALUE

NLS_LANGUAGE AMERICAN

NLS_TERRITORY AMERICA

NLS_CURRENCY $

NLS_ISO_CURRENCY AMERICA

NLS_NUMERIC_CHARACTERS.

NLS_CHARACTERSET UTF8

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

The composition rule of the query NLS_LANG is NLS_LANGUAGE_NLS_TERRITORY.NLS_CHARACTERSET, that is, the operating system environment variable should be set to AMERICAN_AMERICA.UTF8.

Successfully solved the garbled problem, modify .profile (unix system) or .bash _ profile, add

Export NLS_LANG= "AMERICAN_AMERICA.UTF8"

Just do it.

The above is all the contents of the article "how to display garbled codes in sqlplus". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report