just wondering if i can do this... say i have a function foo that returns a number between 0 and 10 every time it's called.. the first time it returns 10, the second time 9, etc. can i set up an empty loop that will call that function until it returns 0? like WHILE foo <> 0 LOOP END LOOP; Code (markup): or do i need to do something like this WHILE i <> 0 LOOP i = foo; END LOOP; Code (markup): just to be clear, foo was just an example function, my actual function will return results based on a query so using a FOR i = 1 to 10 style loop won't work