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


Please Help Members By Posting Answers For Below Questions

what is innodb? : Sql dba

772


What is procedure and function?

692


What is sql and how does it work?

752


What are triggers and its types?

773


What are the sql aggregate functions?

825


What is AUTH_ID and AUTH_USER in pl/sql ?

1950


What is on delete restrict?

728


How do I make my sql query run faster?

676


How do I know if I have sql express or standard?

763


How can a pl sql block be executed?

696


What is the difference between sql and mysql?

770


What is scalar and vector?

731


What is an implicit commit?

768


explain about mysql and its features. : Sql dba

753


Which join is like inner join?

769