I wonder if anyone can help, as part of an application built using plsql I am logging error messages and codes using sqlcode & sqlerrm. I would also like to be able to log the sql statement that actually failed to cause the error.

Is there anyway to actually get at the sql statement.