PSQLException:错误:“ INTO”处或附近的语法错误

时间:2019-06-23 21:09:45

标签: java postgresql

我试图在Java中执行此查询INSERT INTO tpch1g.lineitem_order_30 (SELECT * FROM tpch1g.lineitem_order WHERE number IN('1','2','4'));,以便在PostgreSQL数据库中运行。 我收到此错误:PSQLException: ERROR: syntax error at or near "INTO" 这是我的代码:

String sqlFileInsert= "INSERT INTO " + "\""+tableName + "_order_" + sampleSize+ "\"" + " (SELECT * FROM " + tableName + "_order WHERE number IN('1', '2', '4'));";

 try {
  stmt = conn.createStatement();
 } catch (SQLException e) {
  e.printStackTrace();
 }
 try {
  stmt.executeUpdate(sqlFileInsert);
 } catch (SQLException e) {
  e.printStackTrace();
 }


sqlFileInsert的值为:INSERT INTO tpch1g.lineitem_order_30 (SELECT * FROM tpch1g.lineitem_order WHERE number IN('1','2','4'));

0 个答案:

没有答案