REPEAT function [String]

Function

Concatenates a string a specified number of times.

Syntax

REPEAT ( string-expression, integer-expression )

Parameters

string-expression The string to be repeated.

integer-expression The number of times the string is to be repeated. If integer-expression is negative, an empty string is returned.

NoteThe result datatype of a REPEAT function is a LONG VARCHAR. If you use REPEAT in a SELECT INTO statement, you must have a Large Objects Management option license or use CAST and set REPEAT to the correct datatype and size.

See “REPLACE function [String]” for more information.

Example

The following statement returns the value “repeatrepeatrepeat:”

SELECT REPEAT( 'repeat', 3 ) FROM iq_dummy

Standards and compatibility

See also

“REPLICATE function [String]”