REPEAT

Click to skip syntax diagram
Read syntax diagramSkip visual syntax diagram>>-REPEAT--(--expression--,--integer--)------------------------><
 

The REPEAT function returns a string composed of expression repeated integer times.

expression
An expression that specifies the string to be repeated. The string must be a built-in numeric or string expression. A numeric argument is cast to a character string before evaluating the function. For more information on converting numeric to a character string, see VARCHAR.
integer
An expression that returns a built-in BIGINT, INTEGER, or SMALLINT data type whose value is a positive integer or zero. The integer specifies the number of times to repeat the string.

The data type of the result of the function depends on the data type of the first argument:

Data type of string-expression Data type of the Result
CHAR or VARCHAR or any numeric type VARCHAR
CLOB CLOB
GRAPHIC or VARGRAPHIC VARGRAPHIC
DBCLOB DBCLOB
BINARY or VARBINARY VARBINARY
BLOB BLOB

If integer is a constant, the length attribute of the result is the length attribute of string-expression times integer. Otherwise, the length attribute depends on the data type of the result:

If the length attribute of the result exceeds the maximum for the result data type, an error is returned.

The actual length of the result is the actual length of string-expression times integer. If the actual length of the result string exceeds the maximum for the return type, an error is returned.

If either argument can be null, the result can be null; if either argument is null, the result is the null value.

The CCSID of the result is the CCSID of string-expression.49

Examples


49.
If the value of string-expression is mixed data that is not a properly formed mixed data string, the result will not be a properly formed mixed data string.