My Oracle Support Banner

SQL PreparedStatement Will Cause Any Subsequent PreparedStatement to Hang Until Previous PreparedStatement is Finished (Doc ID 1622515.1)

Last updated on SEPTEMBER 28, 2020

Applies to:

Oracle WebLogic Server - Version 10.3.5 and later
Information in this document applies to any platform.


A prepared statement containing several database queries runs for some amount of time. Once one of the queries in the prepared statement returns the expected result set, it closes the connection, as expected on the code. However, the prepared statement contains other queries which eventually can take more time to finish. If we trigger a second prepared statement while the first one is still running, then thread dumps will show a hogging thread on the following piece of code:

The DB reports that prepared statement 1 has completed when it has not, and then begins to execute prepared statement 2. However, prepared statement 2 cannot complete until after prepared statement 1 has completed, so it only completes after the simulated long-running query in prepared statement 1 has completed. The logical order of execution would be:

  1. Prepared statement 1 is executed
  2. Prepared statement 1 finishes
  3. Prepared statement 2 is executed
  4. Prepared statement 2 finishes


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.