varchar2(10 byte)和varchar2(10 char)有什么不同?

解决方案 »

  1.   

    不好意思没有中文资料The VARCHAR2 datatype specifies a variable-length character string. When you create a VARCHAR2 column, you supply the maximum number of bytes or characters of data that it can hold. Oracle subsequently stores each value in the column exactly as you specify it, provided the value does not exceed the column's maximum length of the column. If you try to insert a value that exceeds the specified length, then Oracle returns an error.You must specify a maximum length for a VARCHAR2 column. This maximum must be at least 1 byte, although the actual string stored is permitted to be a zero-length string (''). You can use the CHAR qualifier, for example VARCHAR2(10 CHAR), to give the maximum length in characters instead of bytes. A character is technically a code point of the database character set. CHAR and BYTE qualifiers override the setting of the NLS_LENGTH_SEMANTICS parameter, which has a default of bytes. For performance reasons, Oracle recommends that you use the NLS_LENGTH_SEMANTICS parameter to set length semantics and that you use the BYTE and CHAR qualifiers only when necessary to override the parameter. The maximum length of VARCHAR2 data is 4000 bytes. Oracle compares VARCHAR2 values using nonpadded comparison semantics.
      

  2.   

    doer_ljy回答正确。
    我刚才作实验了
    SQL> insert into tab_varchar2_a values('123456789a','123456789a');已创建 1 行。SQL> insert into tab_varchar2_a values('123456789a','123456789中');已创建 1 行。SQL> insert into tab_varchar2_a values('123456789中','123456789中');
    insert into tab_varchar2_a values('123456789中','123456789中')
                                      *
    ERROR 位于第 1 行:
    ORA-01401: 插入的值对于列过大