looking for a replacement in MySQL for the SQLERRM and SQLCODE function in Oracle.

Since getting the error message through the API in an external language is easy, I’m assuming that what you want is to extract the errors for some sort of error handling within a Stored Program, so I’m going to point you to the DECLARE … HANDLER page which is the only option that I can think of.

Exactly what you said, extract error msg and number.