Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> RE: Picking CHAR over VARCHAR2
Sometimes it makes sense to put certain kinds of data in a char column.
For example, a state abbreviation which is always two characters.
Straight out of the Oracle Application Developer's Guide is this advice
concerning varchar2 vs. char:
Oracle uses different semantics to compare values of each datatype. You
might choose one datatype over the other if your application is
sensitive to the differences between these semantics. For example, if
you want Oracle to ignore trailing blanks when comparing character
values, you must store these values in CHAR columns.
So, note that for CHAR columns, Oracle will IGNORE trailing blanks in comparisons.
> -----Original Message-----
> From: Doug Cowles [SMTP:dcowles_at_bigfoot.com]
> Posted At: Wednesday, February 24, 1999 10:27 AM
> Posted To: comp.databases.oracle.server
> Conversation: Picking CHAR over VARCHAR2
> Subject: Picking CHAR over VARCHAR2
>
> Char has padded space, making string matches more difficult. So why
> would I pick
> a Char over a VARCHAR2 even if it was only one character?
Received on Wed Feb 24 1999 - 10:16:49 CST