Description
Creates rows of data based either on a specified number of rows, a specified generation period (in seconds), or both
Syntax
GENERATOR( ROWCOUNT => count [ , TIMELIMIT => sec ] )
Parameters
| Parameter | Description | Required |
|---|---|---|
| count | The number of rows to return | Yes |
| sec | The number of seconds the query should run | Yes |
Notes
- count and sec must be non-negative numbers
- 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
- 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
- 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
Example
SELECT
SEQ4() AS NUM
FROM
TABLE (GENERATOR(ROWCOUNT=>10)) AS SEQ;