Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

REPEAT function

Focus mode
REPEAT function - Amazon Redshift

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 | +-------+--------+

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.