Categories: String

REPLACE

Removes all occurrences of a specified substring and replaces them with another string.

Syntax

REPLACE(string_expression varchar, pattern varchar, replacement varchar) → varchar

  • string_expression: String expression in which to do the replacements.
  • pattern: The substring you want replaced in the string_expression.
  • replacement: The string to replace the occurrences of the pattern substring with.

Examples

SELECT REPLACE('THE CATATONIC CAT', 'CAT', 'DOG')
-- sample return 1