November 8th, 2012, 07:12 PM
Looping with changing variable
I would like to run a set of SQL code on a repeat loop, with each loop using a different value for a specific parameter.
In other words, I have a data set (X,Y,Z) and I want to run the code passing X as a variable, using Y, and then again using Z. I actually have more than 3 values to run, I have around 100, so I would prefer to store them in a separate table I can query from on each loop.
I was thinking stored procedure but since I am a novice I have never used them before.
I am using Netezza with Aginity workbench but it's based on postgresql so any help you can provide would be great.