Subject Re: ib_query ignores my data!
Author Norman Dunbar
>> Any additional comments here... Even if someone has said what you think,
>> me know. I am feeling for a strong consensus here.


I use Oracle at work and in the case of a user wishing to have trailing
spaces then they must use a CHAR field - or a LOB of some sort. The user
entry is *always* padded with blanks to the full length of the field width.

To have the minimum space used for a field, then a VARCHAR2 field is used.
This has trailling blanks (which I presume is spaces !) removed. It does
cause problems when extending a VARCHAR2 field, but that is another matter
and is reasonably well handled within Oracle anyway.

Thus if I store "hello world" in a char(15) field I get 4 blanks added to
the end, but if I store it in a VARCHAR2(15) field, I get exactly 11
characters stored.

The data definitions are documented as is their behaiviour, so any database
being designed should use the correct data type for the field. If comms
flags (or whatever) are needed to be stored, then CHAR is the field type,
otherwise VARCHAR.

My opinion, trim VARCHAR and leave/pad CHAR field.

The only difference between Oracle and IBO is that on Oracle, the padding is
carried out by the RDBMS and not by the application - so whatever the user
enters in a field is sent over the network and the RDBMS pads or trims as
appropriate. (Just to complicate matters).

Just my £0.02 on the subject.


Norman Dunbar EMail: NDunbar@...
Database/Unix administrator Phone: 0113 289 6265
Lynx Financial Systems Ltd. Fax: 0113 201 7265