Subject Re: [firebird-support] Passing a BLOB parameter into an exexcute procedure statement
Author Dimitry Sibiryakov
On 13 Jan 2006 at 16:24, Richard Mace wrote:

>I have a procedure called add_message which has an input parameter
>that is a BLOB field.
>
>If I comment out the "execute add_sent_message" statement, it works
>fine. Any ideas?

Your problem is "blob materialization". When you create new BLOB in
your application, it gets temporary blob id. When you use this blob
id in INSERT statement, this blob is "materialized" and temporary id
become invalid.
This process has one annoying consequence: you can't use new blob
id twice. Your case shows that it includes Stored Procedures.
As the solution you have to retrieve the real (materialized) blob
id after insert:

....
SELECT Body FROM MESSAGES WHERE Id=:ipId INTO :ipBody;
EXECUTE PROCEDURE ADD_MESSAGE_SENT(0,:ipBody);
....

--
SY, Dimitry Sibiryakov.