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
position
is0
or 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_string
is 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
, thenNULL
is returned.
Example
Result
INSERT('abc',2,2,'xxx') | INSERT('abcdef',3,2,'CD') |
axxx | abCDef |