Hi Guys的以下法典给我留下了一个错误,即,在一旁是生动地设定参数时,插入一个声明,最后说的是第2页。 形成动态的法典
rs = st.executeQuery("SELECT column_name FROM all_tab_cols
where lower(table_name)= " + tableName + " order by column_id");
sql = new StringBuffer(300);
sql.append("insert into ").append( tableName).append("(");
String prefix="";
while (rs.next())
{
sql.append(prefix).append(rs.getString("column_name"));
values.append(prefix).append("?");
prefix= ",";
iii
sql.append(" ) values(").append(values).append(")");
ps2 = conn.prepareStatement(sql.toString());
while ( (eachLine = in.readLine()) != null))
{
for (int k=stat; k <=45;k++)
{
ps2.setString (k,main[(k-2)]);
iii
stat=45;
for (int l=1;l<= 2; l++)
{
ps2.setString((stat+l),pdp[(l-1)]);// Exception
iii
ps2.addBatch();
iii
这是错误
java.lang.ArrayIndexOutOfBoundsException: 45 at oracle.jdbc.dbaccess.DBDataSetImpl._getDBItem(DBDataSetImpl.java:378) at oracle.jdbc.dbaccess.DBDataSetImpl._createOrGetDBItem(DBDataSetImpl.java:781) at oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:2450) at oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1155) at oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.java:1572) at Processor.main(Processor.java:233)