DB2 Version 9.7 for Linux, UNIX, and Windows

BLOB scalar function

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

The schema is SYSIBM.

The BLOB function returns a BLOB representation of a string of any type.
string-expression
A string-expression whose value can be a character string, graphic string, or a binary string.
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.

Examples
  • 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%')