When I try to query objects, I end up with following error:
ORA-01461: can bind a LONG value only for insert into a LONG column
Could someo
In my particular case, I was trying to store a Base64 encoded file into a table BLOB field, using Mybatis.
So in my xml I had:
<insert id="save..." parameterType="...DTO">
<selectKey keyProperty="id" resultType="long" order="BEFORE">
SELECT SEQ.nextVal FROM DUAL
</selectKey>
insert into MYTABLE(
ID,
...,
PDF
) values (
#{id, jdbcType=VARCHAR},
...,
#{tcPdf, jdbcType=BLOB},
)
</insert>
and in my DTO:
String getPdf(){
return pdf;
}
That makes to Mybatis threat as if were a String char sequence and try to store it as a Varchar. So my solution was the following:
In my DTO:
Byte[] getPdf(){
return pdf.getBytes();
}
And worked.
I hope this could help anybody.
I was facing the same issue and solve it by just replacing VARCHAR
with CLOB
.
This link helped me out.
I encountered this error message when trying to insert String into an XMLTYPE column.
Specifically using Java's PreparedStatement like this:
ps.setString('XML', document);
where XML
here is defined as XMLTYPE.