I get this error when inserting a row into a table with Oracle and a 
LONGVARBINARY column:

java.sql.SQLException: ORA-01483: invalid length for DATE or NUMBER bind 
variable

It turns out that the order the columns appear in the PreparedStatement 
  makes a difference with Oracle.  Any LONG column must be the *LAST* 
bind variable in the INSERT statement with Oracle.  This is only 
relevant if the size of the object is greater than 4000 bytes:

stmt.setBytes(1, new byte[4000]) works fine and
stmt.setBytes(1, new byte[4001]) breaks.

I tried to isolate this problem and was incredibly frustrated as I found 
that my test programs inserting into two column tables (id INTEGER, data 
LONG RAW) seemed to work fine, same driver, same properties, same Torque 
JAR files.  I only discovered the error when I started trying to 
reproduce directly at the Oracle level, by trying to figure out exactly 
what kind of statement could generate this error.  (On insertion, 
Village is not very helpful because it hides the generated SQL.)

The workaround I used was to override the "save(DBConnection)" method in 
the particular object, so I could control the SQL "INSERT" statement.

Anyone else experience this or something similar?

Also, has there been any debate on this list on the merits of LONG RAW 
vs. BLOBs (or BYTEA vs. OID on postgres)?

-- Bill


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to