1

我正在使用以下代码:

query1=" SELECT distinct copy meta.amz_payment1(\"Date\", settlement_id, type, order_id, "
      + "sku, description, quantity, marketplace, fulfillment, order_city, order_state, "
      + "order_postal, product_sales, shipping_credits, promotional_rebates, "
      + "sales_tax_collected, selling_fees, fba_fees, other_transaction_fees,other, "
      + "total_fmt)"
      + "INTO meta.amz_payment1_copy\n" 
      + "from meta.amz_payment1";
stmt.executeUpdate(query1);  // line 153

但它显示以下错误:

org.postgresql.util.PSQLException: ERROR: syntax error at or near "."
  Position: 27
  at 
  at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:331)
  at import_payment.amz_payment.importData(amz_payment.java:153)
  at import_payment.amz_payment.<init>(amz_payment.java:69)
4

2 回答 2

0

尝试使用此查询

INSERT INTO meta.amz_payment1_copy SELECT NEXTVAL('sequenceid'),Date,settlement_id, type, order_id,sku, description,  quantity, marketplace, fulfillment, order_city, order_state,order_postal, product_sales, shipping_credits, promotional_rebates,sales_tax_collected, selling_fees, fba_fees, other_transaction_fees,other,total_fmt
FROM meta.amz_payment1
于 2015-05-13T09:56:27.707 回答
0

Postgres 的语法COPY是例如。

COPY ( select * from yaddayadda where <something> ) TO `filename`

并将数据从表/视图/查询复制到文件。如果你想复制到另一个表,你应该使用

create table yadda_copy ... as select * from yadda

干杯,

于 2015-05-13T09:59:14.907 回答