View Revisions: Issue #5456

Summary 0005456: ORA-24816 when sync varchar2(4000) and long in same table
Revision 2022-09-13 07:44 by qii
Steps To Reproduce use database oracle 11g,
update table who has has column Long and varchar2(4000), when varchar2(4000).length >2000 and Long .length>4000;
Revision 2022-09-14 18:22 by elong
Steps To Reproduce - use database oracle 11g,
- create table with LONG data type that is not the last column
- example: create table mylongclob (id integer primary key, descr2 long, descr1 varchar(4000));
- insert or update table who has has column Long and varchar2(4000), when varchar2(4000).length >2000 and Long .length>4000;
- example:
public class Test {
    public static void main(String[] args) throws Exception {
        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection c = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:xe", "elong", "secret");
        PreparedStatement s = c.prepareStatement("insert into mylongclob (id, descr1, descr2) values (?, ?, ?)");
        s.setInt(1, 5);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 2100; i++) {
            sb.append("a");
        }
        StringBuilder sb2 = new StringBuilder();
        for (int i = 0; i < 4100; i++) {
            sb2.append("a");
        }
        s.setString(2, sb.toString());
        s.setString(3, sb2.toString());
        s.executeUpdate();
        s.close();
        c.close();
    }
}

- error is ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB column
Revision 2022-09-13 07:44 by qii
Additional Information
Revision 2022-09-14 18:22 by elong
Additional Information oerr ora 24816
24816, ... "Expanded non LONG bind data supplied after actual LONG or LOB column"
// *Cause: A Bind value of length potentially > 4000 bytes follows binding for
// LOB or LONG.
// *Action: Re-order the binds so that the LONG bind or LOB binds are all
// at the end of the bind list.