Subject Re: [firebird-support] Stored procedure with blobs and FB1.5
Author Josef Kokeš
Looks like I can solve it by "real" conversion to BLOB using an UDF;
mere assignment from VARCHAR-type variable to a BLOB-type one is not
sufficient, at least not in Firebird 1.5 (even though this article
claims it should work since Firebird 0.9.4:
http://www.volny.cz/iprenosil/interbase/ip_ib_strings.htm)

Pepak

> Hi!
>
> I have just encountered a strange problem with Firebird 1.5:
>
> SET TERM /;
> CREATE TABLE test_table (
> something BLOB
> )
> /
> CREATE PROCEDURE test_write (
> input_value BLOB
> ) AS
> BEGIN
> INSERT INTO test_table VALUES (:input_value);
> END
> /
> EXECUTE PROCEDURE test_write('1')
> /
> EXECUTE PROCEDURE test_write('2')
> /
> EXECUTE PROCEDURE test_write('3')
> /
> EXECUTE PROCEDURE test_write('4')
> /
> EXECUTE PROCEDURE test_write('5')
> /
> DROP PROCEDURE test_write
> /
> DROP TABLE test_table
> /
>
> For some reason, the "EXECUTE PROCEDURE test_write" statements fail
> ("internal error", "Statement failed SQLCODE = -902") on Firebird 1.5.5
> but work OK under 2.1 (and presumably 2.0).
>
> The same thing happens if I declare the input parameter of test_write as
> VARCHAR and convert it to a BLOB before INSERT.
>
> Now I know FB 1.5 is discontinued (and 1.5.5 is not even the latest
> version of that branch) so if it is a bug, it won't be fixed, but as a
> great number of my users still have this version, I wonder if I could
> change the statements somehow to make them work for them. I can use a
> custom UDF for that, if necessary, but I can't update the Firebird itself.