I couldn't find this immediately from the examples. I want to increment a variable in a loop, in a function.
iterator float 4;
iterator = 1;
while iterator < 999
To increment a variable in plpgsql:
iterator := iterator + 1;
There is no
Also, the assignment operator of plpgsql is
And find correct syntax for loops in PL/pgSQL here.
Your code fragment could work like this:
DECLARE iterator float4 := 1; -- you can init at declaration time BEGIN WHILE iterator < 999 LOOP iterator := iterator + 1; -- do stuff END LOOP; END;
Another option would be a FOR loop:
FOR i in 1 .. 999 -- i would be an integer, not a float4 LOOP -- do stuff END LOOP;