Examples
EXECUTE BLOCKexecute block returns (b blob)
as
begin
    -- Create a BLOB handle in the temporary space.
    b = rdb$blob_util.new_blob(false, true);
    -- Add chunks of data.
    b = blob_append(b, '12345');
    b = blob_append(b, '67');
    suspend;
end
EXECUTE BLOCKexecute block returns (s varchar(10))
as
    declare b blob = '1234567';
    declare bhandle integer;
begin
    -- Open the BLOB and get a BLOB handle.
    bhandle = rdb$blob_util.open_blob(b);
    -- Get chunks of data as string and return.
    s = rdb$blob_util.read_data(bhandle, 3);
    suspend;
    s = rdb$blob_util.read_data(bhandle, 3);
    suspend;
    s = rdb$blob_util.read_data(bhandle, 3);
    suspend;
    -- Here EOF is found, so it returns NULL.
    s = rdb$blob_util.read_data(bhandle, 3);
    suspend;
    -- Close the BLOB handle.
    execute procedure rdb$blob_util.close_handle(bhandle);
end
set term !;
execute block returns (s varchar(10))
as
    declare b blob;
    declare bhandle integer;
begin
    -- Create a stream BLOB handle.
    b = rdb$blob_util.new_blob(false, true);
    -- Add data.
    b = blob_append(b, '0123456789');
    -- Open the BLOB.
    bhandle = rdb$blob_util.open_blob(b);
    -- Seek to 5 since the start.
    rdb$blob_util.seek(bhandle, 0, 5);
    s = rdb$blob_util.read_data(bhandle, 3);
    suspend;
    -- Seek to 2 since the start.
    rdb$blob_util.seek(bhandle, 0, 2);
    s = rdb$blob_util.read_data(bhandle, 3);
    suspend;
    -- Advance 2.
    rdb$blob_util.seek(bhandle, 1, 2);
    s = rdb$blob_util.read_data(bhandle, 3);
    suspend;
    -- Seek to -1 since the end.
    rdb$blob_util.seek(bhandle, 2, -1);
    s = rdb$blob_util.read_data(bhandle, 3);
    suspend;
end!
set term ;!
create table t(b blob);
set term !;
execute block returns (bool boolean)
as
    declare b blob;
begin
    b = blob_append(null, 'writable');
    bool = rdb$blob_util.is_writable(b);
    suspend;
    insert into t (b) values ('not writable') returning b into b;
    bool = rdb$blob_util.is_writable(b);
    suspend;
end!
set term ;!