Subject Re: [firebird-support] DataTruncation when querying with like and %
Author Helen Borrie
At 06:22 AM 8/09/2006, you wrote:
>The problem is that 'like' queries throw DataTruncation exceptions or
>produce empty results when the search text reachs the column length or
>the column length -1.
>I'm using Firebird 1.5.3 together with JayBird 2.0.1/2.1.0 (embedded)
>and Hibernate 3.1.3, but I'm posting here because it seems to me that
>this is more related to Firebird.
>I have a sentence of the form:
> ... where fieldName like ?
>Over a VARCHAR field. When I enter %value% as the parameter and value
>has the column length or the column length -1 it breaks.

> Souldn't I be able to query for %value% with value entries as long as
> the column length?

Yes. In fact, I don't get an exception even if the search argument
exceeds the defined length of the varchar, e.g. the column TRACK_ID
is a varchar(5) and the following statement does not except:

select * from track
where track_id like '%ABCDEF%'

Try a similar query in isql.

-- If it excepts there, copy the exact exception message you get and
post it back here *without* the Java code

-- If it gives the correct results, you really do have some problem
in your interface layers/tools configuration