■■请问oracle中的varchar与varchar2 的区别 ??

解决方案 »

  1.   

    是一样的,oracle公司把varchar留作未来使用,不推荐使用
      

  2.   

    有区别。varchar的长度为定义长度,不管你存的是多长,占据的空间都是定长。而varchar2是按照实际长度保存的。但我不知道如果存储信息超出定义长度后,是不是会被截断?
      

  3.   

    两者一样的,类似于同义词
    只是varchar一般都不建议使用而已
      

  4.   

    声明为VARCHAR的列,目前在创建表时被转换成VARCHAR2,不应当使用VARCHAR列,最好使用VARCHAR2。
      

  5.   

    SQL> create table test_char(col1 char(10),col2 varchar(10),col3 varchar2(10));表已创建。SQL> insert into test_char values('aa','aa','aa');已创建 1 行。SQL> select length(col1),length(col2),length(col3) from test_char;LENGTH(COL1) LENGTH(COL2) LENGTH(COL3)
    ------------ ------------ ------------
              10            2            2
    这样应该清楚了吧,char(包括nchar)是定长的,varchar,varchar2,nvarchar2都是可变长度的。
      

  6.   

    VARCHAR
    The VARCHAR datatype stores character strings of varying length. The first two bytes contain the length of the character string, and the remaining bytes contain the string. The specified length of the string in a bind or a define call must include the two length bytes, so the largest VARCHAR string that can be received or sent is 65533 bytes long, not 65535. For converting longer strings, use the LONG VARCHAR external datatype. VARCHAR2
    The VARCHAR2 datatype is a variable-length string of characters with a maximum length of 4000 bytes. 
      

  7.   

    VARCHAR和VARCHAR2是一样的东西,都是可变长的(不会用空格填充的)Varchar不推荐使用,Oracle公司以后可能会用Varchar做其他用途,但Varchar2肯定不会,Oracle公司做过保证
      

  8.   

    都可以变长,可是varchar是oracle公司等以后再扩充的类型
      

  9.   

    呵呵,大家都不习惯看原始的英文解释。
    其实 jlandzpa 贴出的解释说得最清楚了。