I'd really like to use an
ELSE construct and execute multiple statements within the
ELSE blocks, but I don't wish to save my commands to the database as a stored procedure or function. Can I do this in PostgreSQL?
There is the
DO command for ad-hoc plpgsql execution.
But you cannot pass parameters or return rows directly to / from a
BTW, strictly speaking, Postgres does not have "stored procedures" before Postgres 11. Just functions providing very similar functionality. See: