Home  >  Article  >  Database  >  If you query the character encoding of oracle

If you query the character encoding of oracle

青灯夜游
青灯夜游Original
2022-03-02 18:00:0218080browse

How to query Oracle character encoding: 1. Use the "select userenv('language') from dual;" statement to view; 2. Use the "SELECT * FROM NLS_DATABASE_PARAMETERS;" statement to view.

If you query the character encoding of oracle

The operating environment of this tutorial: Windows 7 system, Oracle 11g version, Dell G3 computer.

How to check the character encoding of Oracle database

1. Query the character set of Oracle Server:

There are many ways to find out the character set of the oracle server. The more intuitive query method is the following:

SQL>select userenv(‘language’) from dual;

The results are as follows: AMERICAN _ AMERICA. ZHS16GBK.

2. Query the character set of the dmp file:

The dmp file exported with Oracle's exp tool also contains character set information. The second and third characters of the dmp file 3 bytes record the character set of the dmp file. If the dmp file is not large, such as only a few M or dozens of M, you can open it with UltraEdit (in hexadecimal mode), look at the contents of the second and third bytes, such as 0354, and then use the following SQL to find out its corresponding characters Set:

SQL> select nls_charset_name(to_number('0354','xxxx')) from dual;

ZHS16GBK

3. You can also obtain Oracle’s database character set through the following view

SELECT * FROM NLS_DATABASE_PARAMETERS;--数据库服务器字符集,来源于PROPS$
SELECT * FROM NLS_INSTANCE_PARAMETERS;--客户端字符集,来源于V$PARAMETER
SELECT * FROM NLS_SESSION_PARAMETERS;--会话字符集,来源于V$NLS_PARAMETERS,表示会话自己的设置,可能是会话的环境变量或者是由ALTER SESSION完成,如果会话没有特殊的设置,将与NLS_INSTANCE_PARAMETERS一致
4ELECT * FROM V$NLS_PARAMETERS;
SELECT * FROM SYS.PROPS$;

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of If you query the character encoding of oracle. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn