gpt4 book ai didi

java - 多个 Teradata DDL 查询加上使用 Java 的选择

转载 作者:行者123 更新时间:2023-11-30 10:55:21 25 4
gpt4 key购买 nike

有人可以帮我吗?

我正在尝试使用 Java(Teradata JDBC 驱动程序)执行以下查询:

连接字符串:jdbc:teradata:/xxx.xx.xx.xx/database=XXX,tmode=TERA,charset=UTF8

JDBC 驱动程序:com.teradata.jdbc.TeraDriver

BT;
create MULTISET VOLATILE table A as (
select ...
) WITH DATA primary index (xxx, xxx) on commit preserve rows;

create MULTISET VOLATILE table B as (
select ...
) WITH DATA primary index (xxx, xxx) on commit preserve rows;

create MULTISET VOLATILE table C as (
select ...
) WITH DATA primary index (xxx, xxx) on commit preserve rows;

select x.A, x.B, x.C from join A, B, C
ET;

但我收到以下错误消息:

Exception in thread "main" java.sql.SQLException: [Teradata Database] [TeraJDBC 15.10.00.05] [Error 3932] [SQLState 25000] **Only an ET or null statement is legal after a DDL Statement.**
at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDatabaseSQLException(ErrorFactory.java:308)
at com.teradata.jdbc.jdbc_4.statemachine.ReceiveInitSubState.action(ReceiveInitSubState.java:109)
at com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.subStateMachine(StatementReceiveState.java:307)
at com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.action(StatementReceiveState.java:196)
at com.teradata.jdbc.jdbc_4.statemachine.StatementController.runBody(StatementController.java:123)
at com.teradata.jdbc.jdbc_4.statemachine.StatementController.run(StatementController.java:114)
at com.teradata.jdbc.jdbc_4.TDStatement.executeStatement(TDStatement.java:386)
at com.teradata.jdbc.jdbc_4.TDStatement.executeStatement(TDStatement.java:328)
at com.teradata.jdbc.jdbc_4.TDStatement.doNonPrepExecuteQuery(TDStatement.java:316)
at com.teradata.jdbc.jdbc_4.TDStatement.executeQuery(TDStatement.java:1105)
at dataColector.DataColector.getResultSet(DataColector.java:55)
at CMaestro.getCSVFile(CMaestro.java:1539)
at CMaestro.run(CMaestro.java:125)
at CMaestro.main(CMaestro.java:152)

有什么想法吗?

谢谢

最佳答案

在 Teradata 中,每个 DDL 语句都必须提交,无法在同一事务中运行多个 CREATE TABLE

您必须移除BT/ET

关于java - 多个 Teradata DDL 查询加上使用 Java 的选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33373689/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com