st.executeUpdate("create table clob_tab(c1 int,clob_col clob(10K))");
conn.commit();
pSt=conn.prepareStatement("INSERT INTO clob_tab values (?,?)");
stream = new TestInputStream(size, val);
//this insert fails(size>10K)
pSt.setInt(1, val);
pSt.setAsciiStream(2, stream, size);
assertStatementError("XJ001", pSt);
pSt.close();
conn.rollback();
st.executeUpdate("ALTER TABLE clob_tab ALTER COLUMN "
+"clob_col SET DATA TYPE clob(20K)");
pSt=conn.prepareStatement("INSERT INTO clob_tab values (?,?)");
stream = new TestInputStream(size, val);
//this insert succeed (maximum blob size not increased to 20K)
pSt.setInt(1, val);
pSt.setAsciiStream(2, stream, size);
pSt.executeUpdate();
pSt.close();
//increase the maximum size of the blob
st.executeUpdate("CREATE TABLE blob_tab ( C1 INTEGER," +
"blob_col BLOB(10K) NOT NULL)");
conn.commit();
pSt=conn.prepareStatement("INSERT INTO blob_tab values (?,?)");
stream = new TestInputStream(size, val);
//this insert fails(size>10K)
pSt.setInt(1, val);
pSt.setBinaryStream(2, stream, size);
assertStatementError("22001", pSt);
pSt.close();
conn.rollback();
st.executeUpdate("ALTER TABLE blob_tab ALTER COLUMN "
+"blob_col SET DATA TYPE blob(20K)");
pSt=conn.prepareStatement("INSERT INTO blob_tab values (?,?)");
stream = new TestInputStream(size, val);
//this insert succeed (maximum blob size not increased to 20K)
pSt.setInt(1, val);
pSt.setBinaryStream(2, stream, size);
pSt.executeUpdate();