0

I'd really like to use an IF, ELSE construct and execute multiple statements within the IF and 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?

2

There is the DO command for ad-hoc plpgsql execution.
But you cannot pass parameters or return rows directly to / from a DO command.

BTW, strictly speaking, Postgres does not have stored procedures. Just functions providing very similar functionality.

  • For a more detailed answer you need to write a more detailed question. – Erwin Brandstetter Jun 25 '15 at 17:04
  • Your response was very informative. Thanks for the extra caveat. – JellicleCat Jun 25 '15 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.