Why are you using a WHEN OTHERS in the first place? Why swallowing errors you do not expect? Why dont you RAISE the error back to the caller?
Anyway, move the insert_statement into a separate procedure defined as an autonomous transaction with the desired parameters and call that procedure from your exception block.
The SQLERRM function can't be used directly in a sql statement.
In any case, this code is kind of frightening. In any exception you're going to insert into a table AND commit with no re-raise?
The SQLERRM function can't be used directly in a sql statement
Strange thing is that OP stats it works on one DB and doesn't on another.
In any case, this code is kind of frightening.
(hence I posted Tom's rant again, must be the 102389560242634th time... hopefully it enlightens OP )