DB2 10.5 for Linux, UNIX, and Windows

BLOB scalar function

The BLOB function returns a BLOB representation of a string of any type.

Read syntax diagramSkip visual syntax diagram
>>-BLOB--(--string-expression--+------------+--)---------------><
                               '-,--integer-'      

The schema is SYSIBM.

string-expression
An expression that returns a value of a character string, graphic string, or binary string data type.
integer
An integer value specifying the length attribute of the resulting BLOB data type. If integer is not specified, the length attribute of the result is the same as the length of the input, except where the input is graphic. In this case, the length attribute of the result is twice the length of the input.

The result of the function is a BLOB. If the argument can be null, the result can be null; if the argument is null, the result is the null value.

Example

Given a table with a BLOB column named TOPOGRAPHIC_MAP and a VARCHAR column named MAP_NAME, locate any maps that contain the string 'Pellow Island' and return a single binary string with the map name concatenated in front of the actual map.
   SELECT BLOB(MAP_NAME  CONCAT ':  ') CONCAT TOPOGRAPHIC_MAP
     FROM ONTARIO_SERIES_4
     WHERE TOPOGRAPHIC_MAP LIKE BLOB('%Pellow Island%')