OVERLAY function

OVERLAY is a string manipulation function that manipulates all string data types (BIT, BLOB, and CHARACTER) and replaces part of a string with a substring.

SYNTAX

OVERLAY returns a new string of the same type as the source and is identical to source_string, except that a given substring in the string, starting from the specified numeric position and of the given length, has been replaced by source_string2. When the length of the substring is zero, nothing is replaced.

For example:
OVERLAY ('ABCDEFGHIJ' PLACING '1234' FROM 4 FOR 3)
returns the string 'ABC1234GHIJ'

If any parameter is NULL, the result is NULL. If string_length is not specified, it is assumed to be equal to LENGTH(source_string2).

The result of the OVERLAY function is equivalent to:
SUBSTRING(source_string FROM 1 FOR start_position -1 )
  || source_string2 ||
  SUBSTRING(source_string FROM start_position + string_length)
where || is the concatenation operator.
Related concepts
ESQL overview
Related tasks
Developing ESQL
Related reference
Syntax diagrams: available types
ESQL string manipulation functions