What is the difference between CHAR and VARCHAR2? If
VARCHAR2 serves the uses of CHAR why CHAR is still used and
not been discarded yet?

Answer Posted / satish asnani

Technically CHAR has better performance than VARCHAR2.
For CHAR(10) database already knows the length of value in
each record and therefore displays the entire string up till
10 characters. In case of VARCHAR2 the end of string has to
be reached('\0'-NULL) before the database stops displaying
the characters ahead. Each character is compared to NULL
character before it can be determined that end of string has
arrived. Comparing each string character with NULL character
consumes some CPU cycles and hence VARCHAR2 is slower in
performance as compared to CHAR.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does left join work in sql?

700


what are the t string functions available in tsql? : Transact sql

736


What is procedure explain with example?

704


What is dialect in sql?

703


How do you add a column to a table?

772






What is sql and how does it work?

738


What is mutating trigger?

768


How many types of keys are there in sql?

756


Does sap use sql?

717


How do I install sql?

699


What is sql clause?

740


How do I run pl sql in sql developer?

858


What is dense_rank in sql?

696


How to run sql*plus commands in sql developer?

802


What are variables in pl sql?

789