REPEAT
Descriptionβ
The REPEAT function is used to repeat a string a specified number of times.
Syntaxβ
REPEAT( <str>, <count> )
Parametersβ
Parameter | Description |
---|---|
<str> | The string to be repeated. |
<count> | The number of times to repeat. It must be a non-negative integer. If it is less than 1, an empty string will be returned. |
Return Valueβ
Returns the string repeated the specified number of times. Special cases:
- If any Parameter is NULL, NULL will be returned.
Examplesβ
SELECT repeat("a", 3);
+----------------+
| repeat('a', 3) |
+----------------+
| aaa |
+----------------+
SELECT repeat("a", -1);
+-----------------+
| repeat('a', -1) |
+-----------------+
| |
+-----------------+