INSERT
Purpose
This function replaces the substring of string, with length length beginning at position, with string new_string.
Syntax
insert::=
Usage Notes
- The first character of string has position 1. If the variable
positionis0or outside the string, then the string is not changed. If it is negative, then the function counts backwards from the end. - If
length=0, thennew_stringis just inserted and nothing is replaced. - If
position+length>length(string) or iflength<0, then the string is replaced beginning fromposition. - If one of the parameters is
NULL, thenNULLis returned.
Example
Copy
SELECT INSERT('abc',2,2,'xxx'),
INSERT('abcdef',3,2,'CD');
Result
| INSERT('abc',2,2,'xxx') | INSERT('abcdef',3,2,'CD') |
| axxx | abCDef |