Oracle的VARCHAR和VARCHAR2数据类型有什么区别?

前端之家收集整理的这篇文章主要介绍了Oracle的VARCHAR和VARCHAR2数据类型有什么区别?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
将来自其他DBMS的表迁移到Oracle时,标准任务之一是 replace all VARCHAR(n) fields with VARCHAR2(n) fields(提供n <= 4000). 为什么Oracle像其他DBMS一样调用此数据类型VARCHAR2而不仅仅是VARCHAR?
似乎Oracle曾一度计划为VARCHAR提供与VARCHAR2不同的定义.它告诉客户这个并建议不要使用VARCHAR.无论他们的计划是什么,从11.2.0.2开始,VARCHAR与VARCHAR2相同.这是 the SQL Language Reference 11g Release 2所说的:

Do not use the VARCHAR data type. Use
the VARCHAR2 data type instead.
Although the VARCHAR data type is
currently synonymous with VARCHAR2,
the VARCHAR data type is scheduled to
be redefined as a separate data type
used for variable-length character
strings compared with different
comparison semantics.

PL/SQL User’s Guide and Reference 10g Release 2就是这样说的:

Currently,VARCHAR is synonymous with
VARCHAR2. However,in future releases
of PL/sql,to accommodate emerging sql
standards,VARCHAR might become a
separate datatype with different
comparison semantics. It is a good
idea to use VARCHAR2 rather than
VARCHAR.

Database Concepts 10g Release 2文件用更强的术语说同样的话:

The VARCHAR datatype is synonymous
with the VARCHAR2 datatype. To avoid
possible changes in behavior,always
use the VARCHAR2 datatype to store
variable-length character strings.

Oracle 9.2和8.1.7文档说的基本相同,所以即使Oracle不断阻止使用VARCHAR,到目前为止他们还没有采取任何措施来改变它与VARCHAR2的奇偶校验.

原文链接:https://www.f2er.com/oracle/205305.html

猜你在找的Oracle相关文章