char ,varchar2和varchar的區別
http://blog.csdn.net/ntljy/archive/2004/06/30/30966.aspx
http://www.itpub.net/showthread.php?threadid=36214&pagenumber=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. So, it is a good idea to use VARCHAR2 rather than VARCHAR
-----------------------------
varchar -- 存放定長的字元資料,最長2000個字元;
varchar2 -- 存放可變長字元資料,最大長度為4000字元。
-----------------------------
目前沒有本質的區別
但是:
varchar2是oracle提供的獨特的資料型別
oracle保證在任何版本中該資料型別向上和向下相容
但不保證varchar,這是因為varchar是標準sql提供的資料型別
有可能隨著sql標準的變化而改變
----------------------------
1: char
CHAR Datatype
The CHAR datatype specifies a fixed-length character string. Oracle subsequently
ensures that all values stored in that column have the length specified by size. If you insert a value that is shorter than the column length, then Oracle blank-pads the value to column length. If you try to insert a value that is too long for the column, then Oracle returns an error.
The default length for a CHAR column is 1 byte and the maximum allowed is 2000
bytes. A 1-byte string can be inserted into a CHAR(10) column, but the string is
blank-padded to 10 bytes before it is stored.
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
---------------------------
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-84321/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- char和varchar2的區別
- char(n)和varchar2(n)區別
- VARCHAR2(N CHAR)與VARCHAR2(N)的區別[Oracle基礎]Oracle
- oracle中char與varchar2的區別Oracle
- Oracle CHAR,VARCHAR,VARCHAR2,nvarchar型別的區別與使用Oracle型別
- 【基礎】Oracle CHAR,VARCHAR,VARCHAR2,nvarchar型別的區別與使用Oracle型別
- varchar和char的區別
- Oracle的資料型別:char/varchar2Oracle資料型別
- MySQL中CHAR和VARCHAR區別MySql
- char nchar varchar2 nvarchar2 區別-Oracle (varchar2 max 4K, 2K漢字)Oracle
- NTMySQL中varchar和char型別的區別heeMySql型別
- MySQL 中 VARCHAR 最大長度及 CHAR 和 VARCHAR 的區別MySql
- char,nchar,varchar,nvarchar的區別和特點
- Oracle 中varchar2 和nvarchar2區別Oracle
- Oracle 資料型別CHAR, NCHAR, VARCHAR2, NVARCHAR2Oracle資料型別
- 談MySQL中char varchar區別MySql
- varchar2 與 nvarchar2 區別
- 關於mysql設定varchar 欄位的預設值''和null的區別,以及varchar和char的區別MySqlNull
- 【區別】Oracle官方文件中有關NVARCHAR2、VARCHAR2和VARCHAR資料型別的描述Oracle資料型別
- Sql server char,nchar,varchar與Nvarchar的區別SQLServer
- Oracle中NVARCHAR2與VARCHAR2的區別Oracle
- MySQL字元資料型別char與varchar的區別MySql字元資料型別
- mysql的varchar(N)和int(N)的含義及其與char區別MySql
- PLSQL Language Reference-PL/SQL資料型別-SQL資料型別-CHAR和VARCHAR2變數SQL資料型別變數
- char str[]和char *str的區別
- Mysql中varchar與char的區別以及varchar(30)中的30代表的涵義MySql
- MySQL CHAR和VARCHAR資料型別介紹MySql資料型別
- long型別轉換成varchar2型別
- MySQL中資料型別(char(n)、varchar(n)、nchar(n)、nvarchar(n)的區別)MySql資料型別
- 自導自演的面試現場:說說char 和 varchar的區別你瞭解多少?面試
- MySQL資料型別操作(char與varchar)MySql資料型別
- Proc中使用char陣列、VARCHAR陣列和char變數進行DELETE操作具體行數的細微區別陣列變數delete
- oracle如何變更varchar2型別的列為clobOracle型別
- oracle儲存過程procedure_輸入引數varchar2與char報錯Oracle儲存過程
- Oracle long轉為varchar2Oracle
- ORACLE 檢視 LONG VARCHAR2Oracle
- 你或許不知道的varchar2型別的定義型別
- const char*, char const*, char*const的區別