docs.intersystems.com
Home / InterSystems SQL Reference / SQL Functions / REPEAT

InterSystems SQL Reference
REPEAT
Previous section           Next section
InterSystems: The power behind what matters   
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


Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-05-21 11:15:04