Miscellaneous Functions

In this Topic:

Utility Functions

Data Generation Functions


Sequences generated by these functions may not be ordered, and may not be gap-free. This is because numbers may be generated in parallel, in an unsynchronized fashion. If an ordered, gap-free sequence is required, the global degree of parallelism of the query must be set to 1 through suitable session parameters and/or warehouse configuration.

Random Distribution Functions

Random distribution functions are deterministic functions. Each random distribution function takes a generator expression, gen, as its last argument.

General Usage Notes

The generator expression, gen, may be constant or variable:

  • If constant, then the result of the random distribution function will also be constant (unless there are other, variable arguments, currently only possible for RANDSTR).
  • If variable, then the result of the random distribution function will also be variable.

Generator expressions are always of type 64-bit integer, implicit conversions may apply. Any expression that can be converted into a 64-bit integer may be used as a generator expression.

The randomness of any random distribution function is directly linked to the randomness of its generator expression. For most practical purposes, the RANDOM data generation function is the best choice.