Amazon Redshift will no longer support the creation of new Python UDFs starting November 1, 2025.
If you would like to use Python UDFs, create the UDFs prior to that date.
Existing Python UDFs will continue to function as normal. For more information, see the
blog post
REPEAT function
Repeats a string the specified number of times. If the input parameter is numeric, REPEAT treats it as a string.
Synonym for REPLICATE function.
Syntax
REPEAT(string, integer)
Arguments
- string
-
The first input parameter is the string to be repeated.
- integer
-
The second parameter is an
INTEGER
indicating the number of times to repeat the string.
Return type
VARCHAR
Examples
The following example uses data from the CATEGORY table in the TICKIT sample database. For more information, see Sample database.
To repeat the value of the CATID column in the CATEGORY table three times, use the following example.
SELECT catid, REPEAT(catid,3) FROM category ORDER BY 1,2;
+-------+--------+ | catid | repeat | +-------+--------+ | 1 | 111 | | 2 | 222 | | 3 | 333 | | 4 | 444 | | 5 | 555 | | 6 | 666 | | 7 | 777 | | 8 | 888 | | 9 | 999 | | 10 | 101010 | | 11 | 111111 | +-------+--------+