[1.6.x] Fixed last_executed_query test failure on Oracle

Backport of c0a4894dca from master.