Caché SQL Reference
REPEAT
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

A string function that repeats a string a specified number of times.
Synopsis
REPEAT(expression,repeat-count)
{fn REPEAT(expression,repeat-count)}
Arguments
expression The string expression to be repeated.
repeat-count The number of times to repeat, expressed as an integer.
Description
REPEAT returns a string of repeat-count instances of expression, concatenated together.
If expression is NULL, REPEAT returns NULL. If expression is the empty string, REPEAT returns an empty string.
If repeat-count is a fractional number, only the integer part is used. If repeat-count is 0, REPEAT returns an empty string. If repeat-count is a negative number, NULL, or a non-numeric string, REPEAT returns NULL.
Examples
The following examples show the two forms of REPEAT. Both examples return the string 'BANGBANGBANG':
SELECT REPEAT('BANG',3) AS Tripled
 
SELECT {fn REPEAT('BANG',3)} AS Tripled
 
See Also