FirebirdSQL logo

BLOB_APPEND Examples

execute block
returns (b blob sub_type text)
as
begin
  -- creates a new temporary not closed BLOB
  -- and writes the string from the 2nd argument into it
  b = blob_append(null, 'Hello ');

  -- adds two strings to the temporary BLOB without closing it
  b = blob_append(b, 'World', '!');

  -- comparing a BLOB with a string will close it, because the BLOB needs to be read
  if (b = 'Hello World!') then
  begin
  -- ...
  end

  -- creates a temporary closed BLOB by adding a string to it
  b = b || 'Close';

  suspend;
end

CHAR_LENGTH(), CHARACTER_LENGTH()

String length in characters

Result type

INTEGER, or BIGINT for BLOB

Syntax
  CHAR_LENGTH (string)
| CHARACTER_LENGTH (string)
Table 1. CHAR[ACTER]_LENGTH Function Parameter
Parameter Description

string

An expression of a string type

Gives the length in characters of the input string.

Note
  • With arguments of type CHAR, this function returns the formal string length (i.e. the declared length of a field or variable).If you want to obtain the “logical” length, not counting the trailing spaces, right-TRIM the argument before passing it to CHAR[ACTER]_LENGTH.

  • This function fully supports text BLOBs of any length and character set.