REPLICATE (NoSQL query)

APPLIES TO: NoSQL

Repeats a string value a specified number of times.

Syntax

REPLICATE(<string_expr>, <numeric_expr>)

Arguments

Description
string_expr A string expression.
numeric_expr A numeric expression.

Return types

Returns a string expression.

Examples

The following example shows how to use this function to build a repeating string.

SELECT VALUE {
    catchPhrase: REPLICATE("Cosmic", 3)
}
[
  {
    "catchPhrase": "CosmicCosmicCosmic"
  }
]

Remarks

  • This function doesn't use the index.
  • The maximum length of the result is 10,000 characters.
    • (length(string_expr) * numeric_expr) <= 10,000
  • If numeric_expr is negative or nonfinite, the result is undefined.