gpt4 book ai didi

java - Teradata JDBC 创建 volatile 表错误 3585

转载 作者:搜寻专家 更新时间:2023-11-01 02:46:57 26 4
gpt4 key购买 nike

我以前从未使用过 Teradata JDBC 驱动程序,所以我可能会遇到一些非常明显的问题......

基本上,我正在尝试创建一个我可以从中查询的可变表。

问题

  1. 也许我不能像这样运行 CREATE VOLATILE TABLE 语句...我做错了什么?

  2. 可能驱动版本太旧? (当前为 12.00.00.110)

Java代码

PreparedStatement  pstmtCreateVT = dbConn.prepareStatement(util.getQuery("CREATE_VOLATILE_TABLE_ABC"));
pstmtCreateVT.setInt(1, 7);
pstmtCreateVT.setInt(2, 11);
pstmtCreateVT.executeQuery();

Query.properties

CREATE_VOLATILE_TABLE_ABC = \
CREATE VOLATILE TABLE ABC \
AS ( SELECT DISTINCT t1.NAME \
, lookup.price \
FROM SUPERMARKET.FRUITS t1 \
INNER JOIN SUPERMARKET.PRICING lookup \
ON
lookup.price BETWEEN ? AND ? \
) \
WITH DATA NO PRIMARY INDEX \
ON COMMIT PRESERVE ROWS ;

错误

2013-11-15 09:55:19,220 DEBUG [CreatePoolingConnection.createConnection:102] url: jdbc:teradata://<<some_url_here>>/DATABASE=SUPERMARKET,ENCRYPTDATA=ON,TMODE=ANSI
2013-11-15 09:55:19,673 ERROR [BOMPartsApplicability.fetch:245] ERROR:
com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata Database] [TeraJDBC 12.00.00.110] [Error 3585] [SQLState HY000] USING modifier NOT allowed with DDL.
at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDatabaseSQLException(ErrorFactory.java:277)
at com.teradata.jdbc.jdbc_4.statemachine.ReceiveInitSubState.action(ReceiveInitSubState.java:102)
at com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.subStateMachine(StatementReceiveState.java:285)
at com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.action(StatementReceiveState.java:176)
at com.teradata.jdbc.jdbc_4.statemachine.StatementController.runBody(StatementController.java:108)
at com.teradata.jdbc.jdbc_4.statemachine.StatementController.run(StatementController.java:99)
at com.teradata.jdbc.jdbc_4.Statement.executeStatement(Statement.java:309)
at com.teradata.jdbc.jdbc_4.Statement.prepareRequest(Statement.java:467)
at com.teradata.jdbc.jdbc_4.PreparedStatement.<init>(PreparedStatement.java:53)
at com.teradata.jdbc.jdbc_4.TDSession.createPreparedStatement(TDSession.java:506)
at com.teradata.jdbc.jdbc_3.ifjdbc_4.TeraLocalPreparedStatement.<init>(TeraLocalPreparedStatement.java:84)
at com.teradata.jdbc.jdbc_3.ifjdbc_4.TeraLocalConnection.prepareStatement(TeraLocalConnection.java:328)
at com.teradata.jdbc.jdbc_3.ifjdbc_4.TeraLocalConnection.prepareStatement(TeraLocalConnection.java:149)
at GroceryStore.SetupFruits.fetch(BOMPartsApplicability.java:147)
at GroceryStore.SetupFruits.main(BOMPartsApplicability.java:359)

最佳答案

在我看来,如果您想使用 PreparedStatement 执行 DDL 语句,则不能为它们指定占位符(我刚刚重新创建了您的问题,试图在 DDL 中创建一个带有占位符的简单表).

关于java - Teradata JDBC 创建 volatile 表错误 3585,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20007939/

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