zoukankan      html  css  js  c++  java
  • oracle数据类型varchar2和varchar的区别

    varchar -- 存放定長的字符數據,最長2000個字符;
    varchar2 -- 存放可變長字符數據,最大長度為4000字符。

     

    目前没有本质的区别

    但是:
    varchar2是oracle提供的独特的数据类型
    oracle保证在任何版本中该数据类型向上和向下兼容
    但不保证varchar,这是因为varchar是标准sql提供的数据类型
    有可能随着sql标准的变化而改变

     

    2: varchar2
    VARCHAR2 Datatype
    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. 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.
    3: varchar
    VARCHAR Datatype
    The VARCHAR datatype is currently synonymous with the VARCHAR2 datatype.
    Oracle recommends that you use VARCHAR2 rather than VARCHAR. In the future,
    VARCHAR might be defined as a separate datatype used for variable-length character strings compared with different comparison semantics.

     

     

    char对于不够位数的用空格添补,varchar2不用。可以试着比较一下。

    ---------------------------

    varchar2和varchar的目前没有区别,不过ocacle以后的版本就不支持varchar类型,如果想新版本的数据库兼容就不要用varchar,如果想和其它数据库兼容就不要用varchar2

  • 相关阅读:
    最近的题越来越难了,卧槽,搞一上午一题不会,题解也看不懂
    hdu 4630 树状数组 ****
    hdu 3473 划分树 ***
    hdu 3360 最小点覆盖 **
    hdu 1507 记录路径的二分匹配 **
    poj 3177 边双联通 **
    hdu 4612 边双联通 ***
    Elasticsearch聚合后分页深入详解
    redis 五种数据类型及其使用场景
    再有人问你分布式锁,这篇文章扔给他
  • 原文地址:https://www.cnblogs.com/zhangdongsheng/p/2040836.html
Copyright © 2011-2022 走看看