Nominee for worst error message (Oracle edition)
by Kevin Dangoor
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…)
I had the same problem from a while back:
http://cwinters.com/news/display/?news_id=3208
Life doesn’t have to be this hard…
That error message seemed vastly superior to the one I had. At least that message didn’t mislead you into thinking you were having a problem with a NUMBER field…
For the record, I’ve never had this kind of issue with MySQL. Oracle most definitely has some features that MySQL doesn’t come close to, but it really oughta be better in *every* way, not just a few ways.