[1.7.x] Fixed #23061: Avoided setting a limit on a query for get with select_for_update on Oracle

Thanks Michael Miller for reporting the issue.

Backport of 746f2a4bed from master