──OVERLAY(new,target ─┬─────────────────────────────┬─)── └─,─┬───┬─┬──────────────────┬┘ └─n─┘ └─,─┬──────┬─┬────┬┘ └length┘ └,pad┘
OVERLAY returns the string target, which, starting at the nth character, is overlaid with the string new, padded or truncated to length length. If length is specified, it must be positive or zero. If n is greater than the length of the target string, padding is added before the new string. The default pad character is a blank, and the default value for n is 1. If you specify n, it must be a positive whole number.
Here are some examples:
OVERLAY(' ','abcdef',3) -> 'ab def' OVERLAY('.','abcdef',3,2) -> 'ab. ef' OVERLAY('qq','abcd') -> 'qqcd' OVERLAY('qq','abcd',4) -> 'abcqq' OVERLAY('123','abc',5,6,'+') -> 'abc+123+++'