I'm working with stored procedures in netezza. I want to loop over a range of values. The upper bound on the loop is passed as a variable into the sproc by the user.
i.e. EXECUTE SPROC(12);
so problem is that Netezza (aginity workbench) won't accept this input variable as the upper bound on the loop.
i.e.
DECLARE
x alias as $1.
begin
for i in 1..x loop
...do stufff...
end loop;
end;
I know that this can be solved using loop and exit style loop but It's eating me up as to why i can't do the above given that the documentation suggests that it's possible to do so.
Anyone know why this doesn't work or how to make it work?
Thanks. Clancy.