[1.5.x] Fixed Oracle regression in last_executed_query() with unicode strings

The regression was likely caused by the fix in #19606 which adjusted
Oracle's unicode detection, though it seems this would have been an
issue in some configurations even before.

Backpatch of ce094e570e0ff085b88b2303e25124331f558e45