 <p>There is no <code>PRINT</code> command. Use <code>raise notice</code> instead. </p> <pre><code>create function f() returns void as $$ begin FOR i IN 1..10 LOOP raise notice '%', i; -- i will take on the values 1,2,3,4,5,6,7,8,9,10 within the loop END LOOP; end; $$ language plpgsql; </code></pre> <p><a href="http://www.postgresql.org/docs/current/static/plpgsql.html" rel="nofollow">http://www.postgresql.org/docs/current/static/plpgsql.html</a></p>