In Oracle PL/SQL you can write a SQL script that has procedure control structures (IF/THEN/ENDIF, etc.) without having to explicitly define a function or proc. You need only surround it with DECLARE/BEGIN/END statments. In effect, this gives you "temporary" procs. Can this be done in PostgreSQL 9.x ?