This topic describes how to use the string function REPLACE in Realtime Compute.

Syntax

VARCHAR REPLACE(str1, str2, str3)     

Input parameters

Parameter Data type Description
str1 VARCHAR The source string.
str2 VARCHAR The substring that you want to replace in the source string.
str3 VARCHAR The string that is used to replace the specified substring.

Description

Replaces a substring in a string with another string.

Example

  • Test data
    str1 (INT) str2 (INT) str3 (INT)
    alibaba blink blink flink
  • Test statements
    SELECT REPLACE(str1, str2, str3) as `result`
    FROM T1;     
  • Test results
    result (VARCHAR)
    alibaba flink