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


Please Help Members By Posting Answers For Below Questions

Can we create foreign key without primary key?

705


what are date and time data types? : Sql dba

701


Is the primary key an index?

763


How can we find duplicate records in a table?

662


Explain what is a column in a table?

764






What are the ways on commenting in a pl/sql code?

671


what are the performance and scalability characteristics of mysql? : Sql dba

723


How to check if a column is nullable before setting to nullable?

773


explain the options of myisamchk to improve the performance of a table. : Sql dba

721


What is #table in sql?

706


What is the difference between having clause and where clause?

793


Can a trigger call a stored procedure?

747


What are the three pl sql block types?

719


What is a boolean in sql?

703


How long it takes to learn pl sql?

723