Tuesday, June 30, 2009
Char or Varchar in oracle
Normally most of the time I use varchar in oracle. But for no reason that day I used char. And the result is clear tonight. varchar is in fact variable character. And char is just character. So if you use char no matter how many char you fill in the field but always you will get the length of data in the field as you declared during the table declaration. so in many cases you can not check the that char data against any var char data and also char data if the char field declaration length is not same. So if you are not really sure about the length of your data char type is not a wise type in oracle.
Subscribe to:
Post Comments (Atom)
Like if you have declared a char type of field on your table with length 20. Then whatever data you put on the field you will get the length always 20. Even if you read the field in JAVA, the same thing happens.
ReplyDelete