If you're control is that simple, you can write similar statements in pure SQL:

RDM=# for i in 1 .. 10 loop
RDM-# select "test"
RDM-# end loop;
ERROR:  syntax error at or near "for" at character 1
LINE 1: for i in 1 .. 10 loop

SELECT 'test' FROM


RDM=# if exits ( select * from testtable)
RDM-# then
RDM-# select "TEST"
RDM-# ;
ERROR:  syntax error at or near "if" at character 1
LINE 1: if exits ( select * from testtable)
        ^

 SELECT 'test' FROM testtable LIMIT 1;

Without knowing about what you want to do, I can't guarantee that that will suffice and/or be efficient.  If it gets much more complicated, you might have to go to some procedural language (PL/PGSQL, PL/Perl, etc).  Just remember that SQL is set-based, not procedural.

-Mike

Reply via email to