On 02/09/2008 21:55, Thomas Finneid wrote: > with val_list in > select * from tableA > do > loop > return next val_list; > end loop; Oops - my mistake - it should indeed be FOR, not WITH, hence your error message. One other thing in the above - you don't need the DO, it's just FOR...LOOP...END LOOP. Ray. ------------------------------------------------------------------ Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland rod@xxxxxx Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals ------------------------------------------------------------------