Returns a string consisting of the source string concatenated to itself the number of times specified by the second argument.
REPEAT(x,y)
xis a character-string, bit-string, or picture value, and y is a positive integer expression. If x is an arithmetic value, it is converted to a bit string if it is binary, or to a character string if it is decimal.
DECLARE X CHAR(8); X = REPEAT('AB',3); /* returns X = 'ABABABAB' *
Note that the same result could be produced by using a string repetition factor, as illustrated below:
X = (4) 'AB';
Here is an example of using the REPEAT function for bit–strings:
DECLARE B_STRING BIT(4) STATIC INIT('1110'B); DECLARE B_RESULT BIT(8); B_RESULT = REPEAT(B_STRING,1);
The above example will produce B_RESULT equal to '11101110'B.
None.
Description
The REPEAT function copies a particular string, x, a certain number of times, y, and concatenates the result to the original string x. REPEAT effectively returns a string containing (y+1) occurrences of the string argument with length (y+1) * length (x).