Returns a character string composed of string_exp repeated count times.

Syntax

REPEAT ( string_exp , count )

Notes

  • The string_exp can be of the type fixed-length or variable-length CHARACTER.
  • The count can be of type INTEGER, SMALLINT, or TINYINT.
  • If any of the arguments of the expression evaluates to a NULL, the result is NULL.
  • If the count is negative or zero, the result evaluates to NULL.
  • string_exp and the result can contain multi‑byte characters.

Example

The following example shows how to use the REPEAT function:

SELECT REPEAT(fld1,3) FROM test100WHERE fld1 = 'Afghanistan';
 REPEAT(FLD1,3) 
-----------------
AfghanistanAfghanistanAfghanistan
 1 record selected

Compatibility

ODBC compatible