CREATE or replace FUNCTION ftoc9() RETURNS setof structrankmaster2 LANGUAGE 'plpgsql'The query should be outside the loop, otherwise you are re-running the query each time :-)AS' DECLARE rowdata pss%rowtype; BEGIN for i in 1..3 loop select * into rowdata from pss ; return next rowdata ; end loop; return; end';
Alex ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster