This topic describes how to use the string function OVERLAY in Realtime Compute for Apache Flink.

Syntax

VARCHAR OVERLAY ( (VARCHAR x PLACING VARCHAR y FROM INT start_position [ FOR INT length ]) )

Input parameters

Parameter Data type
x VARCHAR
y VARCHAR
start_position INT
length (optional) INT

Description

Replaces the substring of x with y. The replacement starts from the position specified by start_position. The total number of characters to be replaced is the length value plus one.

Example

  • Test statements
    OVERLAY('abcdefg' PLACING 'hij' FROM 2 FOR 2) as result
    FROM  T1;
  • Test results
    result(VARCHAR)
    ahijdefg