In Oracle varchar2 takes dynamic space for storage then why char is still in oracle?

Questions by Beena   answers by Beena

Showing Answers 1 - 43 of 43 Answers

The mejor defference between varchar2 and char is fixed length and variable length . varchar2 have varible length mean if we declare as 20 space and its use only 5 space the memory asigne only 5 . but in char takes daclare  space  while use any number space  less than declare

any problem / suggetion contact rahultripathi@myway.com  

ramiya

  • Apr 20th, 2006
 

hi plz reply me why we use char still we use varchar2

ranjana tripathi

  • May 18th, 2006
 

char is fixed we know and therefore this is also sure that whenever we will use that it will fix the memory space accordingly still we use it because while working sometimes we are sure that one of the column value should not be tampered or u may say shoulod not be allowed to be tampered by giving them more space so we fix that particular column as char.

Vikram Muddya

  • May 18th, 2006
 

char is used if we know that the length wont exceed the specified range while varchar is used for varying range.

If we want any string not exceeding 6, we use char(6),because we can put a constraint if someone is trying to enter more or less than 6.

Amit

  • May 25th, 2006
 

When we export external data then we used fixed lenght of record this is possible by char or second reson is whenever we use varchar it stores its width which occupies memory. so here two reson is sufficient for char.

Third reason is performance .

umesh

  • Jun 6th, 2006
 

char is of fied length search operation becomes faster since oracle engine has to look for predetermined length of characters.

anil kumar

  • Aug 2nd, 2007
 

The char data type is used in oracle for giving small and single values like T (or) F..
 

NIRANJAN

  • Oct 16th, 2007
 

We can use numbers and characters in char function 
Please try it.ok.

with regaurds
niranjan

The reason for the question is

1. To provide flexibility in oracle i.e we can restrict a column to a limited space 

Example:

you have come across some fields like 6 charecters are mandotory.....that is to enforce security in some areas .(if 6 are fixed that column is fixed....)

2. To improve performance

Example:

In varchar2 unnecessary storage can be recovered by some sort of mechanism which wont be there in char datatyp0e.

so for a column which is fixed usage of char is appropriate than varchar2 that is associated with some mechanism for recovery.

Regards
Ajay,

ds_devi

  • Jan 3rd, 2009
 

char(2) can be used when you want to store state codes and you know that the length is fixed--not less, not more.

  Was this answer useful?  Yes

U.Janki Rao

  • Mar 17th, 2009
 

Of course Varchar2 is there to maintain variable length of columns. It keeps an internal pointer to maintain Variable length that means it wastes two bytes to keep first and last index where column starts and Calculates for each DML operation against that column. So We can Avoid this house keeping work using Char data type if we can estimate the maximum length of the column. So both have it's own significance. Be careful while using varchar2 (It make overhead for each row). Use Char if you are sure with the lump sum length of the column.
Thanks

Prasad

  • Aug 18th, 2011
 

Since Char is fixed length , the processing speed will be more as there is no need of extra work to measure how much an instance of column is used the memory space.

But in Varchar, the processor has to do extra work to measure the amount of memory space used by an instance of column and to reallocate the remaining memory space to other instance. hence the speed of operation is less compared to char.

  Was this answer useful?  Yes

Paras

  • Feb 23rd, 2013
 

To Provide backward compatibility. i.e. program written in older version of Oracle might have CHAR used in it. The newer version should be compatible with it. Thats why CHAR is still there in Oracle ..

  Was this answer useful?  Yes

Vijay Shewale

  • Sep 11th, 2014
 

The reason behind char is still in oracle that is some of the table and objects are stored in oracle in char data types.
to support that data types for that it is still in oracle. one more thing that is char allows the limited character and size of memory so we can use this data types in such limited cases.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions