Syntax
INSERT (str1,pos,len,str2)
Purpose
You can call this function to return the str1 string, with the substring starting from pos and is len characters long replaced with str2. If pos exceeds the string length, the original string is returned. If len is greater than the length of the rest of the string, the substring starting from the position pos is replaced. If any argument is NULL, the return value is NULL. This function supports multi-byte characters.
str1andstr2must be strings, andposandlenmust be integers. If any argument isNULL, the return value isNULL.The characters in
str1andstr2are considered as byte streams.If
posis a negative value or exceeds the length ofstr1,str1is returned.When
lenis less than 0 or exceeds the length ofstr1, a string that combinesstr1from the beginning toposandstr2is returned.
Examples
obclient> SELECT INSERT('Quadratic',-2,100,'What'), INSERT('Quadratic',7,3,'What'),
-> INSERT('Quadratic',-1,3,'What'), INSERT('Quadratic',10,3,'What'), INSERT('Quadratic',5,-1,''),
-> INSERT('Quadratic',7,-1,'What')\G
*************************** 1. row ***************************
INSERT('Quadratic',-2,100,'What'): Quadratic
INSERT('Quadratic',7,3,'What'): QuadraWhat
INSERT('Quadratic',-1,3,'What'): Quadratic
INSERT('Quadratic',10,3,'What'): Quadratic
INSERT('Quadratic',5,-1,''): Quad
INSERT('Quadratic',7,-1,'What'): QuadraWhat
1 row in set (0.00 sec)