Subject Re: [ib-support] Adding blobs in SP
Author Helen Borrie
At 12:32 AM 14-09-02 +0000, you wrote:
>How can I add two blobs in an SP?
>This is where I'm up to...
>alter PROCEDURE INSERT_SUPPLIER (~snip~, Note BLOB, ~snip~)
> if (f_BlobSize(Note) > 0) then
> update SUPPLIERS set NOTE = String2Blob(f_BlobAsPChar(NOTE) ||
>f_BlobAsPChar(:Note)) where SUPLRNO=:id;
>END !!
>This just clears the blob field!
>Do I have to convert the CSTRING returned by f_BlobAsPChar() to a
>VARCHAR somehow first?
>Using FB1/XP/FreeUDFLib

A blob isn't a string so you can't concatenate two blobs and make another
blob out of them. When a blob is "updated" it is actually replaced, i.e.
the old BlobID is made null and a new BlobID set to point to the new blob.

Did you know that in Firebird you can actually pass a string type directly
to a blob?

alter PROCEDURE INSERT_SUPPLIER (~snip~, Note varchar(100), ~snip~)
if (f_StringLength(:NOTE) > 0) then
update SUPPLIERS set NOTE = f_BlobAsPChar(NOTE)||:NOTE
where SUPLRNO=:id;