Oracle10 and JDBC: how to make CHAR ignore trailing spaces at comparision?
Note that Oracle compares CHAR
values using blank-padded comparison semantics.
From Datatype Comparison Rules,
Oracle uses blank-padded comparison semantics only when both values in the comparison are either expressions of datatype CHAR, NCHAR, text literals, or values returned by the USER function.
In your example, is 'ONT'
passed as a bind parameter, or is it built into the query textually, as you illustrated? If a bind parameter, then make sure that it is bound as type CHAR
. Otherwise, verify the client library version used, as really old versions of Oracle (e.g. v6) will have different comparison semantics for CHAR
.