I have a simple Derby database I'm using for testing. The following query gives me the results I expect:

        statement.execute("SELECT root_URL FROM b");

Usually that's just 2 rows depending on how I've set up the test.

However if I change it to this I get no results:

        statement.execute("SELECT root_URL FROM b ORDER BY id");

That is, the ResultSet now contains zero rows.

Does this make any sense to anyone? I don't see how adding an ORDER BY clause should change the *number* of results I get. I've tried several forms of statement and connection (though all from within JDBC, not yet ij or something else; and all with Scrollable result sets) and it really does seem that the only thing that matters is if I have an ORDER BY clause or not.

No ORDER BY clause: all expected results (in no particular order)
ORDER BY clause: no results.

No exceptions are thrown on evaluation. (I do get some later exceptions that are a direct result of not having any results to work with.)

Can anyone explain or justify this behavior? Am I missing something obvious? Or is this a real bug? Thanks.

--
Elliotte Rusty Harold
erharold@gmail.com