Hello.
RAD 11.3 / Unidac 9.4.0 / Windows 10 Pro version 22H2
I have problem with ParamByName in Query component.
Field in Table is defined as CHAR(1)
SQL: Select * from <table> where <field> LIKE '%A%'
If the code is
Q.SQL.Add('SELECT * from <table> where <field> LIKE '+'%A%'.QuotedString)
then SQL is executed without errors
If the code is
Q.SQL.Add('SELECT * from <table> where <field> LIKE :fValue')
Q.ParamByName('fValue').AsString := '%A%';
then SQL return error:"Dynamic SQL Error SQL error code = -303 arithmetic exception, numeric overflow, or string truncation string right truncation"
Error is on Firebird v2.5.9. On PostgreSQL v15 or Oracle everything working without errors.
When I change field length to CHAR(3) then SQL executes without errors so the problem is because query thinks that '%A%' are 3 letters.
Is this Firebird problem (which I doubt because SQL without ParamByName works), or there is some specific Firebird option that is needed to be set to query work without error.
I Know that this example should be <field>='A' ('=' not 'LIKE') but LIKE should work too.
Thanks for answer.