Subject Re: Firebird 3.x error “Attem pt to execute an unprepared d ynamic SQL statement” in De lphi IBX exception handling?
Author

It appears, that Delphi XE 10.2 code makes the second call only in the specific case:

if (fetch_res = isc_bad_stmt_handle) then

And that makes the erroneous second call rare enough to solve the problem in my question. So, the solution is to replace the initial general condition (fetch_res <> isc_lock_conflict) with the more specific condition (fetch_res = isc_bad_stmt_handle)

That completes my question, the problem solved.