The challenge is in stored procedures to assemble a binary value to blob and then save the table. The problem is that the stored procedure works with the blob as text, e.g., if I want to insert into blob byte 4, than byte 52 is inserted (for byte ASCII number 4).
I tried different cast, but nothing works. If stored procedure update blob into a table, which is a parameter of the function, so it works fine.
How to work with binary values (full byte) in a stored procedure?
CREATE PROCEDURE PROC__TESTBLOB (
INID Integer,
INDATABLOB Blob sub_type 0 )
RETURNS (
RESULT Varchar(20) )
AS
DECLARE VARIABLE VAR_BLOB blob sub_type 0;
BEGIN
BEGIN
BEGIN
--update tab_test set datablob = :INDATABLOB where id = :INID; --This work fine
VAR_BLOB = CAST(4 AS BLOB(0));--not work, blob is still byte 52 (ascii number 4)
VAR_BLOB = 3;--not work, blob is still byte 51 (ascii number 3)
update tab_test set datablob = :VAR_BLOB where id = :INID;--This does not work
RESULT = 'OK';
END
WHEN ANY DO RESULT = 'ERR';
END
SUSPEND;
END^
UPDATE Firebird version 3.0.0.32483 64bit