repeat

Repeats a string a specified number of times.

Syntax

repeat(<string>, n => <n>)

Arguments

ArgumentTypeDescription
<string>stringString to repeat.
nintConstant. Non-negative repetition count. Must not be NULL.

Returns

Returns string. A count of 0 returns an empty string. Returns NULL if the input is NULL.

Examples

Repeat a dash to separate fields in a text label:

SELECT 'Checkout failures ' || repeat('-', n => 12) AS heading
+--------------------------------+
| heading                        |
+--------------------------------+
| Checkout failures ------------ |
+--------------------------------+