What is difference between CHAR and VARCHAR2?What is the
maximum SIZE allowed for each type?
Answer Posted / sushant
Both CHAR and VARCHAR2 types are used to store string values but both behave very differently.
CHAR should be used to store fix length strings. String values will be space/blank padded towards right before storing on disk. If this type is used to store varibale length strings, it will waste a lot of disk space. For example we can use it to store fields where we have one character only like IS_MINOR char (1). Here we will store only 'Y' or 'N' hence it becomes a prefect candidiate for char data type.
VARCHAR2 is used to store variable length character strings. The string value's length will be stored on disk with the value itself.
Explanation with an example could be found here :
http://www.oraclebin.com/2012/11/difference-between-char-and-varchar2.html
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the advantages of normalization?
How sql query is executed?
What is the use of function in sql?
What plvcmt and plvrb does in pl/sql?
how to get a list of indexes of an existing table? : Sql dba
Why is pl sql needed?
What are the various levels of constraints?
Why function is used in sql?
What is trigger and how to use it in sql?
What is the purpose of cursors in pl/sql?
What is the difference between cluster and non-cluster index?
what is rollback? : Sql dba
What is a dynamic query?
What is graph sql?
how to use in conditions? : Sql dba