【问题标题】:Multiple Teradata DDL queries plus a select using Java多个 Teradata DDL 查询以及使用 Java 的选择
【发布时间】:2016-01-27 04:50:22
【问题描述】:

有人可以帮我吗?

我正在尝试使用 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)

有什么想法吗?

谢谢

【问题讨论】:

    标签: java jdbc teradata


    【解决方案1】:

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

    您必须删除BT/ET

    【讨论】:

    • 感谢您的回答。我必须改变获取数据的方式,我的意思是,我创建了一个包含所有我需要的连接的单一选择。无论如何,我感谢您的帮助。
    猜你喜欢
    • 2013-05-03
    • 1970-01-01
    • 2017-04-30
    • 2020-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-25
    相关资源
    最近更新 更多