二、使用Unicode在需要支持多国语言的环境里,使用Unicode可以轻松解决数据存储问题。

Oracle中支持以下几种Unicode编码?AL32UTF8

使用1,2,3个字节进行编码,扩展字符集使用4个字节。

The AL32UTF8 character set supports the latest version of the Unicode standard. It encodes characters in one, two, or three bytes. Supplementary characters require four bytes. It is for ASCII-based platforms.

?UTF8

使用1,2,3个字节进行编码,扩展字符集使用看作2个字符处理,占6个字节。Oracle建议使用AL32UTF8作为数据库字符集。

The UTF8 character set encodes characters in one, two, or three bytes. It is for ASCII-based platforms.

Supplementary characters inserted into a UTF8 database do not corrupt the data in the database. A supplementary character is treated as two separate, user-defined characters that occupy 6 bytes. Oracle recommends that you switch to AL32UTF8 for full support of supplementary characters in the database character set.

?UTFE

The UTFE character set is for EBCDIC platforms. It is similar to UTF8 on ASCII platforms, but it encodes characters in one, two, three, and four bytes. Supplementary characters are converted as two 4-byte characters.

?UTF-16

使用2个字节进行编码,扩展字符集使用4个字节。

One character can be either 2 bytes or 4 bytes in UTF-16. Characters from European and most Asian scripts are represented in 2 bytes. Supplementary characters are represented in 4 bytes. UTF-16 is the main Unicode encoding used for internal processing by Java since version J2SE 5.0 and by Microsoft Windows since version 2000.

(查看Unicode编码的一个方法:按Alt + X 组合键,MS Word会将光标前面的字符同其十六进制的四位 Unicode 编码进行互相转换)

Oracle中支持Unicode有2种方式可以使用2种方式来支持Unicode。

? Unicode Database。创建DB的时候指定数据库字符集为AL32UTF8 ( CREATE DATABASE...CHARACTER SET AL32UTF8),SQL字符类型(CHAR, VARCHAR2, CLOB, and LONG)的字段中存储的就是UTF-8编码的Unicode数据。

? Unicode Data Type。指定列或变量的类型为national character data types。包括NCHAR, NVARCHAR2, and NCLOB。national character data types可以使用UTF8 or AL16UTF16作为字符集,默认为AL16UTF16。创建数据库的时候可以指定(CREATE DATABASE...NATIONAL CHARACTER SET AL16UTF16/UTF8)。

注意,NCHAR和NVARCHAR2的长度是字符数,不是字节数。

如果使用AL16UTF16字符集,NCHAR和NVARCHAR2的最大长度分别是1000和2000个字符。The maximum length limits for the NCHAR and NVARCHAR2 columns are 1000 and 2000 characters, respectively. Because the data is fixed-width, the lengths are guaranteed.( 实际上,如果包含Unicode扩展字符,最大长度也有可能到不了1000和2000?)

如果使用UTF8字符集,NCHAR和NVARCHAR2的最大长度分别是2000和4000个字符。

但是实际可以存储的字符数量还是受限于2000和4000个字节。例如NVARCHAR2(2000),如果存储1000个汉字(3000字节)+1000个英文没有问题,但是如果存储2000个汉字(6000字节)就不行了。

You can store Unicode characters in an Oracle Database in two ways:

? You can create a Unicode database that enables you to store UTF-8 encoded characters as SQL character data types (CHAR, VARCHAR2, CLOB, and LONG).

? You can declare columns and variables that have SQL national character data types.

The SQL national character data types are NCHAR, NVARCHAR2, and NCLOB. They are also called Unicode data types, because they are used only for storing Unicode data.

The national character set, which is used for all SQL national character data types, is specified when the database is created. The national character set can be either UTF8 or AL16UTF16 (default).

When you declare a column or variable of the type NCHAR or NVARCHAR2, the length that you specify is the number of characters, not the number of bytes.查看数据库字符集和National Character字符集的方法。

select * from v$nls_parameters;

NLS_CHARACTERSET - 数据库字符集

NLS_NCHAR_CHARACTERSET - National Character字符集

选择Unicode Database还是Unicode Data Type,Oracle给出的建议:

以下情况建议使用Unicode Database

Situation

Explanation

You need easy code migration for Java or PL/SQL.

Java和PL/SQL代码迁移方便

If your existing application is mainly written in Java and PL/SQL and your main concern is to minimize the code changes required to support multiple languages, then you may want to use a Unicode database solution. If the data types used to stored data remain as SQL CHAR data types, then the Java and PL/SQL code that accesses these columns does not need to change.

You have evenly distributed multilingual data.

很多地方使用多语言数据

If the multilingual data is evenly distributed in existing schema tables and you are not sure which tables contain multilingual data, then you should use a Unicode database because it does not require you to identify the kind of data that is stored in each column.

Your SQL statements and PL/SQL code contain Unicode data.

PL/SQL的代码中包含Unicode数据

You must use a Unicode database. SQL statements and PL/SQL code are converted into the database character set before being processed. If the SQL statements and PL/SQL code contain characters that cannot be converted to the database character set, then those characters are lost. A common place to use Unicode data in a SQL statement is in a string literal.

You want to store multilingual documents in BLOB format and use Oracle Text for content searching.

在BLOG类型中存储多语言的文档

You must use a Unicode database. The BLOB data is converted to the database character set before being indexed by Oracle Text. If your database character set is not UTF8, then data is lost when the documents contain characters that cannot be converted to the database character set.

oracle支持几国语言,Oracle数据库多语言支持相关推荐

  1. DML语言(数据库操作语言)和DQL语言(数据库查询语言)

    DML语言(数据库操作语言)和DQL语言(数据库查询语言) 1.DML语言(Data Manipulation Language) 1.1.添加语句(insert) INSERT INTO `teac ...

  2. oracle支持几国语言,明白ORACLE的多国语言设置

    wlgyhnj(冷风0) 明白ORACLE的多国语言设置,ORACLE多国语言设置是为了支持世界范围的语言与字符集,一般对语言提示,货币形式,排序方式和CHAR,VARCHAR2,CLOB,LONG字 ...

  3. oracle数据库sql培训,Oracle数据库SQL语言实战培训教程(全面、详细、案例、精讲)套餐...

    风哥oracle数据库SQL语言实战培训教程(案例.精讲)套餐,DBA必备技能. 套餐介绍: 风哥Oracle数据库SQL语言实战培训教程(案例.精讲)套餐,DBA必备技能. 内容: SQL语言基础入 ...

  4. docker构建oracle集群,docker 构建 oracle数据库 镜像-Go语言中文社区

    前言 之前docker 部署的 oracle 镜像,突然从 dockerhub 下架了.所以没办法,只能自己打包一个oracle 数据库的镜像. 找来找去,其实oracle 自身就提供了oracle ...

  5. oracle 中sql的分类,Oracle数据库语言分类

    Oracle数据库语言分类 一.DML(data manipulation language)数据操纵语言:查询.操纵数据表资料行 DML主要用来对数据库的数据进行一些操作. select : 检索数 ...

  6. oracle32588,19c恢复 – 专业Oracle数据库恢复,或许是您恢复数据的最后机会@phone:13429648788 - 专业Oracle数据库恢复技术支持...

    有客户找到我们,他们的oracle 19c数据库由于异常断电,导致启动异常,经过一系列恢复之后,依旧无法解决问题,请求我们给予支持.通过我们的Oracle数据库异常恢复检查脚本(Oracle Data ...

  7. oracle - - 注释符,Oracle数据库扩展语言PL/SQL之注释、分隔符和标识符

    点击蓝字关注我吧 [本文详细介绍了Oracle数据库扩展语言PL/SQL的注释.分隔符和标识符,欢迎读者朋友们阅读.转发和收藏!] 1 基本概念 1.1 注释 注释不会被数据库编译,只是给开发人提供一 ...

  8. 【云和恩墨大讲堂】盖国强 - Oracle 数据库的架构演进和我的学习之路

    "云和恩墨大讲堂" 线上课程周四晚分享继续.本期我们的分享嘉宾是中国地区首位 Oracle ACE 总监,同时也是云和恩墨创始人 - 盖国强先生.他将围绕两方面主题展开,Oracl ...

  9. oracle v¥bh,ORACLE数据库sql语言、函数及常用命令

    file=c:\database\ydxt200108170926.dmp log=c:\database\ydxt200108170926.log fromuser=cur touser=cur1 ...

最新文章

  1. hdu 1724 Ellipse——辛普森积分
  2. yarn 切换 设置 镜像 源
  3. 团队软件开发第一次冲刺(二)
  4. jq实现点击导航栏中的任意一个跳转后被点击的定位到第一个
  5. 【转】用BlazeMeter录制JMeter测试脚本
  6. 虚拟机环境下安装ESX不能安装虚拟系统解决方案
  7. 利用WindowsAPI创建窗体(c++)
  8. Modeling Deformable Objects from a Single Depth Camera
  9. 安装python多少内存_Python进程使用的全部内存?
  10. windows开发——配置pthread.h头文件
  11. random随机数类
  12. 评论安装_评论送|机电安装监理质量控制要点130页
  13. 企业微信小程序(企业内部)怎么自定义工作台和通过中文名模糊查询到员工的个人信息和userid
  14. linux 中文乱码 解决方法
  15. pt达人教你如何用pttools批量刷新pt站点数据
  16. pybind11中文资料(第五章 面向对象的代码)
  17. python循环嵌套打印小星星_python基础:嵌套循环及例子(打印小星星,九九乘法表)...
  18. Android 360度全景照片展示
  19. 问题 F: 【数论】青蛙的约会
  20. 在职场,光有技术是不行的,18年老程序员职场宝贵经验分享

热门文章

  1. the cluster is down
  2. 用计算机算判定系数,使用系数
  3. php 正序 倒序代码,php foreach正序倒序输出示例代码
  4. 转:基于Turbo C2.0 的动画设计的例子
  5. 【报告分享】2020中国跨境电商市场发展报告-CBEC(附下载)
  6. 大咖说*对话开源|企业如何用好开源数据库
  7. 读书寄语:要想收获,就得先付出
  8. Docker网络和存储管理
  9. Windows XP系统服务配置攻略(转)
  10. 如何让Ubuntu在老旧设备上飞速运行!