OVERLAY
|
Where
new is a string expression.
target is a string expression.
n is an integer expression. This is optional.
length is an integer expression. This is optional.
pad is a 1-character string constant or 2-digit hexadecimal constant used for padding. This is optional.
Results
String
Function
The OVERLAY function returns the string target, which, starting at the nth character, is overlaid with the string new, padded or truncated to the value of length. Overlays may also extend beyond the end of the optional target string. If n is greater than the length of the target string, padding is added before the new string. The default for n is 1. If length is not specified, it defaults to a value equal to the length of the string expression new. The default value for pad is a blank (X'40').
Examples
a = OVERLAY(' ','abcdef',3) /* Assigns 'ab def' to "a" */
b = OVERLAY('.','abcdef',3,2) /* Assigns 'ab. ef' to "b" */
c = OVERLAY('qq','abcd') /* Assigns 'qqcd' to "c" */
d = OVERLAY('qq','abcd',4) /* Assigns 'abcqq' to "d" */
e = OVERLAY('123','abc',5,6,'+') /* Assigns 'abc+123+++' to "e" */