Generator Operator

A Generator operator produces a result set without input.

Like an Iterator, a Generator lets you specify JavaScript expressions for initializing variables, updating variables, and testing for termination. Unlike an Iterator, a Generator does not accept inputs. Like a Projection operator, a Generator allows you to specify the names and types of the output columns, as well as JavaScript expressions for computing the values in each row.

When a Generator is first called, it executes the Initialize expression you supply to initialize variables. On each call, Generator follows this sequence:


  1. Tests the termination condition.

  2. If the termination condition has not been met, it generates a row with the designated schema by executing all of the user-specified JavaScript expressions.

  3. Executes the Increment expression you supply to update variables.

The output of the Generator is the sequence of rows created in these iterations.

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.