Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column

I'm getting following exception, while updating table in Hibernate

ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column

I have extracted sql query as well, it looks like

Update table_name set columnName (LOB)=value, colmun2 (String with 4000)=value where id=?;

Entity class

class Test{

    @Lob
    private String errorText;

    @Column(length = 4000)
    private String text;
}

Please help me, what is wrong in this

Thanks Ravi Kumar

like image 807
1097733 Avatar asked Apr 28 '14 12:04

1097733


2 Answers

Place your LOB binding at the last. See if that solves the issue..

like image 77
Srikrishnan Suresh Avatar answered Dec 24 '22 20:12

Srikrishnan Suresh


I do realise that this thread is quite old, but I thought I'd share my own experience with the same error message here for future reference.

I have had the exact same symptoms (i.e. ORA-24816) for a couple of days. I was a bit side-tracked by various threads I came across suggesting that this was related to order of parameter binding. In my case this was not a problem. Also, I struggled to reproduce this error, it only occurred after deploying to an application server, I could not reproduce this through integration tests.

However, I took a look at the code where I was binding the parameter and found:

preparedStatement.setString(index, someStringValue);

I replaced this with:

preparedStatement.setClob(index, new StringReader(someStringValue));

This did the trick for me.

This thread from back in 2009 was quite useful.

like image 44
Kristoffer Avatar answered Dec 24 '22 20:12

Kristoffer