Why does JDBC driver pad some blank characterS other a queried field, from an Oracle Database? Why does JDBC driver pad some blank characterS other a queried field, from an Oracle Database? database database

Why does JDBC driver pad some blank characterS other a queried field, from an Oracle Database?


CHAR Datatype:

The CHAR datatype specifies a fixed-length character string. Oracle ensures that all values stored in a CHAR column have the length specified by size. If you insert a value that is shorter than the column length, then Oracle blank-pads the value to column length.


Don't forget to trim your values while using char. Or don't use char, use varchar2, until you are providing the exact sized value as the column size.

You might want to know why, so here it is.


Have you already read the Oracle documentation on Oracle length semantics for character datatypes?

http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#sthref3787