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 / madhavi
Hi,
Char is the datatype that occupies complete space declared
whether used or not. ie:- If any field is declared as char
(10) then this field for all records will occupy complete
10 bytes whether the value stored in it is 1 byte or 10
byte.
Whereas Varchar2, as the first 3 characters explains Var-
Variable, will occupy only the bytes for the value entered
in the field.
So ideally it is good practice to declare fields like
emp_flg or any other fields which we are sure will have
fixed length value as Char.
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba
What is sap sql?
What is implicit cursor in pl sql?
How do I remove duplicates in two columns?
How do I delete a trigger?
How many postgresql users are there, worldwide?
Can triggers stop a dml statement from executing on a table?
What is pivot query?
What is a unique key?
what is the use of set statement in tsql? : Transact sql
What are sql*plus environment variables?
What are the benefits of triggers?
Do foreign keys improve performance?
What's the difference between inner join and left join?
How to run sql functions in pl/sql?