Friday, August 18, 2006

Oracle error messages: could try harder

I've not been able to find a way of loading a complete Oracle PL/SQL script via a JDBC connection (i.e. analogous to using @ in sqlplus). So, least worst thing to do (it's a small script) is to load the script into a string, and execute that string with Statement.executeUpdate. One. Statement. At. A. Time. Sigh.

Nevertheless, things are going OK until I take a line of my script which works when invoked by @, but from JDBC I see:

java.sql.SQLException: ORA-00911: invalid character
 at oracle.jdbc.driver.DatabaseError.throwSqlException(
 at oracle.jdbc.driver.T4CTTIoer.processError(
 at oracle.jdbc.driver.T4CTTIoer.processError(
 at oracle.jdbc.driver.T4C8Oall.receive(

"ORA-00911 Invalid character." That's all you get. Which character for pity's sake? And whereabouts in the string? Surely that's not asking too much?

The answer, by the way, is that the trailing semi-colon that statements require in sqlplus is an error when executing statements via JDBC.

No comments: