PostgreSQL repeat() Function

The PostgreSQL repeat() function repeats the specified string the specified number of times and returns the reuslt.

repeat() Syntax

This is the syntax of the PostgreSQL repeat() function:

repeat(string, number)

Parameters

string

Required. The string to repeat.

number

Required. The number of times to repeat.

Return value

The PostgreSQL repeat() function repeats the specified string the specified number of times and returns the reuslt.

repeat() Examples

This example shows how to use repeat() to repeat the string Hello 3 times:

SELECT repeat('Hello', 3) AS "repeat('Hello', 3)";
 repeat('Hello', 3)
--------------------
 HelloHelloHello