Helmut Steinberger wrote:

I have a problem when trying to fetch blob fields using params. Example:

I have a table with:

field1 varchar (30)
field2 blob sub_type text

Then I do the following

select
field1
from table1
where field2 containing
:param1

When I put in a string longer then 30 charcters ( for example 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') into param1 I get an error message

"Can't format message 13:697 -- message system code -4.
Dynamic SQL Error.
SQL error code = -303.
Arithmetic exception, numeric overflow, or string truncation."

This problem doesn't come up, when I do the following

select
field1
from table1
where field2 containing
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

Could anybody explain me that?

Dimitry Sibiryakov answers:

30 characters is server's default length for string params. It is used when required length cannot be derived from context. Use:

CAST(:PARAM AS VARCHAR(200))

Like this post? Share on: TwitterFacebookEmail


Related Articles


Author

Firebird Community

Published

Category

Gems from Firebird Support list

Tags