我设计了一个表,想把这个表的一些列显示在另一个表里,其中几个是以和的形式。这是我在ecslipes里写的代码:
Connection conn = ConnectionFactory.getConnection();
String sql ="insert into t_huizong select plannumber,client,operator,SUM(numberall),SUM(sumprice),deliverytime,consignment from t_user GROUP BY plannumber,client,operator,deliverytime,consignment ";
try {
PreparedStatement pstmt = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
pstmt.setString(1, plannumber);
ResultSet result = pstmt.executeQuery();
} catch (SQLException e1) {
e1.printStackTrace();
} 其中SQL语句在oracle中得sql/plus 命令行能运行,pstmt.setString(1, plannumber);这行根据一些东西了解是plannumber在sql语句中要有?来填充,要用到where plannumber like ?||'%',但是添加到里面就是得到无效sql语句错误,如果去掉又会得到赋值变量不存在错误,希望哪位大侠能帮忙解决一下,万分感谢!!!
Connection conn = ConnectionFactory.getConnection();
String sql ="insert into t_huizong select plannumber,client,operator,SUM(numberall),SUM(sumprice),deliverytime,consignment from t_user GROUP BY plannumber,client,operator,deliverytime,consignment ";
try {
PreparedStatement pstmt = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
pstmt.setString(1, plannumber);
ResultSet result = pstmt.executeQuery();
} catch (SQLException e1) {
e1.printStackTrace();
} 其中SQL语句在oracle中得sql/plus 命令行能运行,pstmt.setString(1, plannumber);这行根据一些东西了解是plannumber在sql语句中要有?来填充,要用到where plannumber like ?||'%',但是添加到里面就是得到无效sql语句错误,如果去掉又会得到赋值变量不存在错误,希望哪位大侠能帮忙解决一下,万分感谢!!!
SQL语句中 where后面是?吧!