1. The syntax of replace()
REPLACE ( string_replace1 , string_replace2 , string_replace3 )
Parameter analysis:
string_replace1 The string expression to be searched. string_replace1 can be character data or
binary data
string_replace2 The string expression to be searched. string_replace2 can be character data or
binary data.
string_replace3 The string expression used for replacement. string_replace3 can be character data or
binary data.
2. The role of replace()
Replace all occurrences of string_replace2 in string_replace1 with string_replace3.
Three. Examples
1. String type parameters:
SELECT REPLACE(‘abcdefg bcd’,‘bcd’,‘xxx’)
结果:
axxxefg xxx
2. Binary type parameters:
SELECT REPLACE(100111001101,111,000)
result:
1000001101