Nominee for worst error message (Oracle edition)

Sep 2, 2004 22:34 · 202 words · 1 minute read

So, we’ve been happily using Hibernate to store our object graph in Oracle with a minimum of fuss. Yesterday, trying to work with a certain set of data, we started hitting this lovely error message from Oracle:

ORA-01483: invalid length for DATE or NUMBER bind variable

By setting logging to “COPIOUS BUCKETFULLS” we could conveniently see that the query in question was an insert into a table with three columns. There was only one column that was a date or number, so one would think that column was the problem.

Of course, one would turn out to be wrong. The other two columns were CLOBs, and Oracle CLOBs don’t just let you setString to something larger than 4000 characters. Java programmers everywhere are suffering through this. Gah.

The problem itself is really annoying, but that error message is the real kicker. It doesn’t even mention a CLOB! Just goes to show that usability is important for APIs, and not just end-user software.

If you’re a Hibernate user, the official Hibernate page on this topic has some code to help get around this problem. It’s not pleasant, but what else can you do? (Short of writing your own Oracle JDBC driver, I guess…)