Нашел, если кому надо:
Blob parameters 
Testing NULL values in blob input parameters is easy. Blob parameters are 
passed to UDF as a pointer to BLOB structure. If the parameter is NULL, then 
blob_handle element of this structure will be zero. 
Full BLOB structure definition/description can be found either in Developer's 
Guide or in jrd/val.h file (IB/FB source code) or in include/ibase.h file 
(Firebird only). 

Example
This function will return either blob size, or -1 if the parameter is NULL 
type
  TBlob = record
    GetSegment         : Pointer;
    BlobHandle         : ^Integer;
    SegmentCount       : LongInt;
    MaxSegmentLength   : LongInt;
    TotalSize          : LongInt;
    PutSegment         : Pointer;
  end;
  PBlob = ^TBlob;


function TEST_BlobSize(inBlob: PBlob): integer; cdecl;
begin
  Result := -1;
  if (not Assigned(inBlob)) or
     (not Assigned(inBlob^.BlobHandle)) then Exit;

  Result := inBlob^.TotalSize;
end;


DECLARE EXTERNAL FUNCTION TEST_BlobSize
  BLOB
  RETURNS INTEGER BY VALUE
  ENTRY_POINT 'TEST_BlobSize' MODULE_NAME 'UDF_Examples';


CREATE TABLE TAB3 (I INTEGER, B BLOB);
INSERT INTO TAB3 (I,B) VALUES (1, 'abc');
INSERT INTO TAB3 (I,B) VALUES (2, '');
INSERT INTO TAB3 (I,B) VALUES (3, NULL);
/* Note: Firebird can insert strings to blob fields directly. */
/* With InterBase you may need to use UDF for String->Blob conversion. */


SELECT I, TEST_BlobSize(B) FROM TAB3;

      I TEST_BLOBSIZE
======= =============
      1             3
      2             0
      3            -1
С наилучшими пожеланиями, Oleg Prosvetov.

Ответить