当Oracle中VARCHAR2的大小声明为1个字节时,这是什么意思? [英] What does it mean when the size of a VARCHAR2 in Oracle is declared as 1 byte?
问题描述
我知道我可以使用应该包含的字符数来声明 varchar2
.
I know that I can declare a varchar2
using the number of the characters that it should be able to contain.
但是,在我正在使用的Oracle
数据库中,我发现一个字段(名为PDF)的定义如下:
However, in an Oracle
database on which I am working, I found that a field (named PDF) is defined as follows:
VARCHAR2(1 BYTE)
这是什么意思?它可以包含几个字符?
What does this mean? How many characters can it contain?
另一个相关的问题: VARCHAR
和 VARCHAR2
有什么区别?
Another, related question: What is the difference between a VARCHAR
and a VARCHAR2
?
推荐答案
您可以将列/变量声明为varchar2(n CHAR)和varchar2(n byte).
You can declare columns/variables as varchar2(n CHAR) and varchar2(n byte).
n CHAR表示变量将包含n个字符.在多字节字符集中,您并不总是知道要存储多少个字节,但是您确实想保证一定数量的字符的存储.
n CHAR means the variable will hold n characters. In multi byte character sets you don't always know how many bytes you want to store, but you do want to garantee the storage of a certain amount of characters.
n个字节仅表示您要存储的字节数.
n bytes means simply the number of bytes you want to store.
不推荐使用varchar.不要使用它. varchar和varchar2有什么区别?
varchar is deprecated. Do not use it. What is the difference between varchar and varchar2?
这篇关于当Oracle中VARCHAR2的大小声明为1个字节时,这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!