With parameters before the tables together! Home.

To recover from errors PLpgSQL can trap the errors using the Exception clause For this.