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

What is the best partition size for windows 10?

477


What is AUTH_ID and AUTH_USER in pl/sql ?

1683


Explain the methods used to protect source code of pl/sql.

535


What is the process of debugging?

543


What is group function in sql?

523






What is the importance of sqlcode and sqlerrm?

838


What is crud sql?

534


How to handle bulk data?

888


what is the use of friend function? : Sql dba

533


How do you truncate?

498


Does pdo prevent sql injection?

519


What is clustered and nonclustered index in sql?

491


Is it possible to read/write files to-and-from PL/SQL?

648


How to start the command-line sql*plus?

560


What is a data definition language?

546