Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?

Answers were Sorted based on User's Feedback



What is the difference between CHAR and VARCHAR2? If VARCHAR2 serves the uses of CHAR why CHAR is ..

Answer / hannan

in char it allocates the memory space as static where as in
varchar2 it allocates the memory space as dynamic


OR

char is a space mapping function where as in varchar2 it is
not mapping the space it occupies the exact size of the
string

Is This Answer Correct ?    22 Yes 0 No

What is the difference between CHAR and VARCHAR2? If VARCHAR2 serves the uses of CHAR why CHAR is ..

Answer / chandu

Have more diff between char and varchar2

char size only 2000 bytes in sql, default size is 1 byte.
it will occupying the trailing spaces. so much of memory wasted.

varchar2 size 4000 bytes in sql and no default size.
it will not occupying the trailing spaces.

Is This Answer Correct ?    18 Yes 0 No

What is the difference between CHAR and VARCHAR2? If VARCHAR2 serves the uses of CHAR why CHAR is ..

Answer / 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

What is the difference between CHAR and VARCHAR2? If VARCHAR2 serves the uses of CHAR why CHAR is ..

Answer / 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

What is the difference between CHAR and VARCHAR2? If VARCHAR2 serves the uses of CHAR why CHAR is ..

Answer / suriya

Another difference is accessing a variable declared as char
is faster than, accessing a varchar2.

Is This Answer Correct ?    3 Yes 0 No

What is the difference between CHAR and VARCHAR2? If VARCHAR2 serves the uses of CHAR why CHAR is ..

Answer / pradeep

in char it allocates the memory space as static where as in
varchar2 it allocates the memory space as dynamic.

Another difference is accessing a variable declared as char
is faster than, accessing a varchar2. So CHAR is still used

Is This Answer Correct ?    3 Yes 0 No

What is the difference between CHAR and VARCHAR2? If VARCHAR2 serves the uses of CHAR why CHAR is ..

Answer / manish ranjan

1. Char is fundamental data type. VARCHAR2 is derived one.
2. Char allocates static memory space while VARCHAR2
allocates dynamic memory.
3. Char is required to maintain compatibility with other
tools (Reporting, DWH, Data related).
4. Char is faster than VARCHAR2 (for large text).

Is This Answer Correct ?    3 Yes 0 No

What is the difference between CHAR and VARCHAR2? If VARCHAR2 serves the uses of CHAR why CHAR is ..

Answer / masthan

create table test(aa char):=by using char create the table with out spicifing the lengh(by default it will create lenth 1)default size is 1 byte

by using varchar2 with out spicifing the lengh we cont able to create the table.There is no default size

Is This Answer Correct ?    1 Yes 0 No

What is the difference between CHAR and VARCHAR2? If VARCHAR2 serves the uses of CHAR why CHAR is ..

Answer / laxmi narayana moru

VARCHAR2() IS USED TO STORE ALPHANUMERICAL DATA WHERE AS
CHAR() IS USED TO STORE THE CHARACTERS ONLY AND WHICH IS
FIXED LENGTH DATATYPE ...
CHAR() IS PROVIDING FAST ACCESSING COMPARE WITH THE VARCHAR2
()(50%).

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More SQL PLSQL Interview Questions

What is sql injection vulnerability?

0 Answers  


What is difference between hql and sql?

0 Answers  


Can we join two tables without common column?

0 Answers  


What is self-join and what is the requirement of self-join?

0 Answers  


Begin For j in 4403201000 .. 4403202000 Loop If mod (j, 100) = 0 then Dbms_output.put_line (j); End if; End loop; End; what will be the output of this question

7 Answers   TCS,


what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba

0 Answers  


How does join work in sql?

0 Answers  


how to fetch common records from two tables? : Sql dba

0 Answers  


What are different types of triggers?

0 Answers  


What are the different types of functions in sql?

0 Answers  


What are the types of dbms?

0 Answers  


3. Select sum(a) sum_1,max(a) max_1 ,count(a) count_1 from ( ( select 1 a from dual union all Select to_number(‘2011’) a from dual union all select 1 a from dual) union select 2 b from dual);

1 Answers   Fintellix,


Categories