I'm running the following query in Hypersonic DB (HSQLDB):
SELECT (CASE foo WHEN 'a' THEN 'bar' WHEN 'b' THEN 'biz' ....
ELSE 'fin' END ) FROM MyTable LIMIT 1
When the number of "WHEN" clauses exceeds about 1000, I get a Java StackOverflowError
thrown by the JDBC driver in org.hsqldb.jdbc.Util.sqlException()
.
Here's the really weird part: I tried breaking up my CASE
statement into pieces with e.g. 100 WHEN clauses followed by ELSE ( CASE foo WHEN ... ) END
. But even with this rewrite I get exactly the same behavior!
I don't see any reference to a limit of 1000 or anything else in the HSQLDB manual. Help!