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
How to download oracle sql developer?
Why use subqueries instead of joins?
What is a record in a database?
Why sql query is slow?
What is the difference between stored procedure and view?
How to prepare for oracle pl sql certification?
What is difference between my sql and sql?
What is not in sql?
how to present a past time in hours, minutes and seconds? : Sql dba
How to rename a column in the output of sql query?
Is delete faster than truncate?
How to install oracle sql developer?
What is difference between ms sql and mysql?
what are the features and advantages of object-oriented programming? : Sql dba
Why do we need sharding?