GENERATOR
functionsupportedCore SQL functionsCreates rows of data based either on a specified number of rows, a specified generation period (in seconds), or both. This system-defined table function enables synthetic row generation. Note that it is possible to generate virtual tables with 0 columns but possibly many rows. Such virtual tables are useful for queries whose SELECT clause consists entirely of data-generating functions.
Syntax
supportedpartialnot supportednot scored
GENERATOR( ROWCOUNT => <count> [ , TIMELIMIT => <sec> ] )
GENERATOR( [ TIMELIMIT => <sec> ] )
Usage notes
- count and sec must be non-negative integer constants.
- If only the ROWCOUNT argument is specified, the resulting table will contain count rows.
- If only the TIMELIMIT argument is specified, the query runs for sec seconds, generating as many rows as possible within the time frame. The exact row count depends on the system speed and is not entirely deterministic.
- If both the ROWCOUNT and TIMELIMIT arguments are specified, then: If the ROWCOUNT is reached before the TIMELIMIT, the resulting table will contain count rows.
- If the TIMELIMIT is reached before the ROWCOUNT, the table will contain the number of rows generated within the time frame. The exact row count depends on the system speed and is not entirely deterministic.
- If ROWCOUNT or TIMELIMIT is null, it will be ignored. So generator(ROWCOUNT => null) generates 0 rows.
- If both parameters (ROWCOUNT and TIMELIMIT) are omitted, the GENERATOR function returns 0 rows.
- The content of the rows is determined by the functions in the projection clause, not by the GENERATOR function itself. For more details, see the Examples section below. See also the description(s) of the specific functions (e.g. SEQ()), that you plan to use in the projection clause; not all valid functions produce sequences without gaps.