Messages from Database Procedures
Database procedures use the SQL MESSAGE statement to return messages to users and applications. (The SQL MESSAGE statement is not the same as the forms MESSAGE statement.) Messages from database procedures can be trapped using the WHENEVER SQLMESSAGE statement or the SET_SQL(MESSAGEHANDLER) statement.
Messages from database procedures can return to your application before the database procedure has finished executing. For this reason, any message-handling routine must not execute any database statements in the current session. To issue database statements from a message-handling routine, switch sessions or open another session; if your message-handling routine switches sessions, it must switch back to the original session before returning from the message-handling routine.