This will have to be custom per DBMS. [Here](http://www.postgresql.org/docs/8.3/static/plpgsql-errors-and-messages.html)'s the relevant pgsql page.