哪里是我的无效角色(ORA-00911)我正在尝试将CLOBs插入数据库(请参阅相关问题)。我无法弄清楚出了什么问题。我有一个大约85个clobs的列表,我想插入表中。即使只插入我得到的第一个clob ORA-00911: invalid character。我无法弄清楚如何PreparedStatement在执行之前获取声明,因此我无法100%确定它是正确的,但如果我做对了,那么它看起来应该是这样的:insert all into domo_queries values ('select
substr(to_char(max_data),1,4) as year,
substr(to_char(max_data),5,6) as month,
max_data
from dss_fin_user.acq_dashboard_src_load_success
where source = ''CHQ PeopleSoft FS''')select * from dual;最终,这个insert all陈述会有很多into,这就是我不做常规insert陈述的原因。我没有在那里看到无效的角色,对吗?(哦,当我在我的sql开发人员工具中运行它时,上面的代码运行正常。)如果我删除了分号PreparedStatement,它会抛出ORA-00933: SQL command not properly ended错误。在任何情况下,这是我执行查询的代码(以及上面示例的变量值)。public ResultSet executeQuery(String connection, String query, QueryParameter... params) throws DataException, SQLException {
// query at this point = "insert all
//into domo_queries values (?)
//select * from dual;"
Connection conn = ConnectionPool.getInstance().get(connection);
PreparedStatement pstmt = conn.prepareStatement(query);
for (int i = 1; i <= params.length; i++) {
QueryParameter param = params[i - 1];
switch (param.getType()) { //The type in the example is QueryParameter.CLOB
case QueryParameter.CLOB:
Clob clob = CLOB.createTemporary(conn, false, oracle.sql.CLOB.DURATION_SESSION);
clob.setString(i, "'" + param.getValue() + "'");
//the value of param.getValue() at this point is:
/*
* select
* substr(to_char(max_data),1,4) as year,
* substr(to_char(max_data),5,6) as month,
* max_data
* from dss_fin_user.acq_dashboard_src_load_success
* where source = ''CHQ PeopleSoft FS''
*/
pstmt.setClob(i, clob);
break;
case QueryParameter.STRING:
pstmt.setString(i, "'" + param.getValue() + "'");
break;
}
}有什么我只是错过了很多时间吗?
添加回答
举报
0/150
提交
取消