- Get link
- X
- Other Apps
VARCHAR:
The VARCHAR data type is used to store character values. It's fixed value data type means once it's initialized, we cannot change the size at the execution time. So, it's called static data type. It can store maximum 2000 bytes of character data. For each character one byte will be stored in memory.
If you store 5 characters in varchar(10), the 5 bytes will be stored in oracle and other 5 bytes will lead to memory wastage.
Varchar is external data type. It's ANSI SQL standard and it's definition may change in future by oracle.
Varchar can identify null and empty strings separately.
VARCHAR2:
The VARCHAR2 data type is also used to store character values. It's variable length -data type means it's character value can be changed while execution. So, it's called dynamic data type. It can store maximum 4000bytes of data. For each character one byte will be stored in memory. Since it's dynamic data type, memory will not wasted.
If you store 5 characters in varchar2(10), only 5 bytes will be stored in oracle and no memory will be wasted(extra spaces will be truncated).
Varchar2 is internal data type. It's oracle standard and it's definition won't change in the future.
Varchar2 cannot identify null and empty strings separately, both are same for it.
It's advisable to use VARCHAR2 instead of VARCHAR.
Comments
Post a Comment