Create Iterator

Summary

The CREATE ITERATOR command allows iteration over a result set. An iterator sets variable values for each row in the <command> result set and then invokes the given pipeline or step.  The variable names are the column names returns in the result set of <command>.

Syntax

create iterator [if not exists] <name> for (step | pipeline) <step or pipeline name> over <command>;

Parameters

Parameter
Description
[if not exists]
Create if it doesn’t already exist
<step or pipeline name> The name of the object to invoke in a loop
<command> The command generating the results set over which iterating

Details

Use the SHOW STEPS or SHOW PIPELINES command to identify the step or pipeline name

Examples

create iterator iterator_1 for pipeline p1 over 
select name as v_period_name from xactly.xc_period;

When iterator_1 is invoked, the “over” command will be executed.  For each row in the result set, the variable v_period_name will be set to the value of the v_period_name column in the row, and then the pipeline p1 will be invoked synchronously.

Related Commands