我正在使用以下代码:
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)
答案 0 :(得分: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
答案 1 :(得分:0)
Postgres syntax for COPY
就是例如。
COPY ( select * from yaddayadda where <something> ) TO `filename`
将数据从表/视图/查询复制到文件。如果要复制到另一个表,则应使用
create table yadda_copy ... as select * from yadda
干杯,