多个 Teradata DDL 查询加上 select 使用 Java

Multiple Teradata DDL queries plus a select using Java

有人可以帮我吗?

我正在尝试使用 Java (Teradata JDBC driver) 执行以下查询:

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

JDBC driver: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