Interaction with the dependency system

Derby internally
tracks the dependencies of prepared statements, which are SQL statements that
are precompiled before being executed. Typically they are prepared (precompiled)
once and executed multiple times.

Prepared statements depend on the dictionary objects and statements they
reference. (Dictionary objects include tables, columns, constraints, indexes,
views, and triggers.) Removing or modifying the dictionary objects or statements
on which they depend invalidates them internally, which means that Derby will
automatically try to recompile the statement when you execute it. If the statement
fails to recompile, the execution request fails. However, if you take some
action to restore the broken dependency (such as restoring the missing table),
you can execute the same prepared statement, because Derby will
recompile it automatically at the next execute request.

Statements depend on one another-an UPDATE WHERE CURRENT statement depends
on the statement it references. Removing the statement on which it depends
invalidates the UPDATE WHERE CURRENT statement.

In addition, prepared statements prevent execution of certain DDL statements
if there are open results sets on them.

Manual pages for each statement detail what actions would invalidate that
statement, if prepared.