ORA-00604: 递归 SQL 级别 1 发生错误

2023-12-20

我开始得到以下内容SQL exception我不知道这个异常的根本原因是什么?我也关门了dbconnection and prepared statement也。那么问题出在哪里呢?

java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
ORA-00604: error occurred at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
ORA-01000: maximum open cursors exceeded

下面是我正在使用的代码。我的代码有什么问题吗?

for (Entry<Integer, LinkedHashMap<Integer, String>> entry : GUID_ID_MAPPING.entrySet()) {

    pstatement = db_connection.prepareStatement(PDSLnPConstants.UPSERT_SQL); // create a statement
    pstatement.setInt(1, entry.getKey());
    pstatement.setString(2, entry.getValue().get(PDSLnPConstants.CGUID_ID));
    pstatement.setString(3, entry.getValue().get(PDSLnPConstants.PGUID_ID));
    pstatement.setString(4, entry.getValue().get(PDSLnPConstants.SGUID_ID));
    pstatement.setString(5, entry.getValue().get(PDSLnPConstants.UID_ID));
    pstatement.setString(6, entry.getValue().get(PDSLnPConstants.ULOC_ID));
    pstatement.setString(7, entry.getValue().get(PDSLnPConstants.SLOC_ID));
    pstatement.setString(8, entry.getValue().get(PDSLnPConstants.PLOC_ID));
    pstatement.setString(9, entry.getValue().get(PDSLnPConstants.ALOC_ID));
    pstatement.setString(10, entry.getValue().get(PDSLnPConstants.SITE_ID));
    pstatement.executeUpdate();

    }

} catch (SQLException e) {
    getLogger().log(LogLevel.ERROR, e);
} finally {
    if (pstatement!= null) {
    try {
        pstatement.close();
        pstatement = null;
    } catch (SQLException e) {
        getLogger().log(LogLevel.ERROR, e.getMessage(), e.fillInStackTrace());
    }
    }
    if (db_connection!= null) {
    try {
        db_connection.close();
        db_connection = null;
    } catch (SQLException e) {
        getLogger().log(LogLevel.ERROR, e.getMessage(), e.fillInStackTrace());
    }
    }

我觉得PreparedStatement定义应该从循环中取出并通过调用在循环中重用clearParameters:

pstatement = db_connection.prepareStatement(PDSLnPConstants.UPSERT_SQL); // create a statement

for (Entry<Integer, LinkedHashMap<Integer, String>> entry : GUID_ID_MAPPING.entrySet()) {

    pstatement.setInt(1, entry.getKey());
    pstatement.setString(2, entry.getValue().get(PDSLnPConstants.CGUID_ID));
    pstatement.setString(3, entry.getValue().get(PDSLnPConstants.PGUID_ID));
    pstatement.setString(4, entry.getValue().get(PDSLnPConstants.SGUID_ID));
    pstatement.setString(5, entry.getValue().get(PDSLnPConstants.UID_ID));
    pstatement.setString(6, entry.getValue().get(PDSLnPConstants.ULOC_ID));
    pstatement.setString(7, entry.getValue().get(PDSLnPConstants.SLOC_ID));
    pstatement.setString(8, entry.getValue().get(PDSLnPConstants.PLOC_ID));
    pstatement.setString(9, entry.getValue().get(PDSLnPConstants.ALOC_ID));
    pstatement.setString(10, entry.getValue().get(PDSLnPConstants.SITE_ID));
    pstatement.executeUpdate();

    pstatement.clearParameters();

}

您可能还想研究批处理(addBatch)。如果您正在测试,您可能需要等待一段时间才能清理现有的“打开”游标。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ORA-00604: 递归 SQL 级别 1 发生错误 的相关文章

  • 验证 sql/oracle 中的电子邮件/邮政编码字段

    对于以下方面的一些建议将不胜感激 是否可以通过 oracle 中的 sql 中的某种检查约束来验证电子邮件和邮政编码字段 或者我怀疑 pl sql 带有正则表达式的这种事情 Thanks 这是电子邮件地址的正则表达式语法 包括引号 a zA
  • Postgresql 串行错误自动增量

    我在 postgresql 上遇到问题 我认为 postgresql 中有一个错误 我错误地实现了一些东西 有一个表包括colmn1 primary key colmn2 unique colmn3 插入一行后 如果我尝试使用现有的另一次插
  • sql server 2008 对 exec 语句的限制

    我只需要仔细检查 t sql 中的 EXEC 命令是否有字符限制 如果我有一个带有 varchar max 的变量并使用 EXEC 执行命令 你认为这样可以吗 thanks 应该没问题 根据这篇 MSDN 文章 http msdn micr
  • Sql Server 的夏令时

    我们正在使用一个以 C Unix 格式存储日期的旧应用程序 C 时间基本上是自 1970 年 1 月 1 日以来的秒数 日期以整数形式存储在 SQL Server 数据库中 我正在为使用这些日期的报告编写视图 到目前为止 我正在使用以下命令
  • 使用转义换行符和回车符取消转义字符串

    我正在尝试编写一个 PLPGSQL 函数来混淆 审查 编辑文本 Obfuscate a body of text by replacing lowercase letters and numbers with symbols CREATE
  • 将图像列保存到 SQL Server 2000 中的文件

    我在 SQL Server 2000 中有一个包含图像列的表 我需要将图像数据保存到文件系统上的文件中 在 SQL Server 2005 中 我可以使用 ADODB Stream 对象进行文件 I O 但这在 SQL Server 200
  • SQL 选择 n 到 m 关系

    我有一个n to m之间的关系Author and Book 表作者 ID Name 1 Follett 2 Rowling 3 Martin 桌书 ID Title Category 1 A Dance with Dragons Fant
  • REGEXP_REPLACE - 仅当包含在 () 中时才从字符串中删除逗号

    我在 oracle 论坛网站找到了一个例子 输入字符串 a b c x y z a xx yy zz x WITH t AS SELECT a b c x y z a xx yy zz x col1 FROM dual SELECT t c
  • RANK() OVER PARTITION 并重置 RANK

    如何获得在分区更改时重新启动的 RANK 我有这张表 ID Date Value 1 2015 01 01 1 2 2015 01 02 1
  • 如何在 PostgreSQL 中使用条件和子查询创建唯一索引?

    我使用 PGSQL 并尝试添加下面的索引 CREATE UNIQUE INDEX fk client ON user client fk client WHERE fk client NOT IN SELECT fk client FROM
  • 在 SQL 中按键组对行进行顺序编号?

    SQL中有没有办法按顺序添加行号按关键组 假设一个表包含任意 CODE NAME 元组 示例表 CODE NAME A Apple A Angel A Arizona B Bravo C Charlie C Cat D Dog D Dopp
  • 如何对多行的一列值求和?

    我有这个表 我想添加几行的 change 列的值 或者更准确地说 从 ne 值为零的行到 ne 值为零的下一行 不是第二个本身 任何答案将不胜感激 rn date ne change 0 2008 12 07 0 10330848398 1
  • 如何计算 Postgres 上图表中所有连接的节点(行)?

    我的桌子有account id and device id One account id可以有多个device ids 反之亦然 我正在尝试计算每个连接的多对多关系的深度 Ex account id device id 1 10 1 11
  • Npgsql 参数化查询输出与 PostGIS 不兼容

    我在 Npgsql 命令中有这个参数化查询 UPDATE raw geocoding SET the geom ST Transform ST GeomFromText POINT longitude latitude 4326 3081
  • 如何进行数据透视并计算列平均值

    我承认这是迄今为止我必须面对的最复杂的 SQL 语句之一 我在这件事上碰壁了 我希望有人能帮我一把 我在数据库中有这张表 Item ActiveTime sec DateTime 1 10 2013 06 03 17 34 22 gt Mo
  • Magento --“SQLSTATE[23000]:违反完整性约束..”客户更新

    迁移服务器后 每次尝试更新客户信息时都会出现错误 我正在使用一个客户激活插件 http www magentocommerce com magento connect vinai extension 489 customer activat
  • SQLite (Android):使用 ORDER BY 更新查询

    Android SQLite 我想要在 myTable 中的其他行之间插入行在android中使用SQLite 为此 我尝试增加从第 3 行开始的所有行的 id 这样 我就可以在位置 3 处插入新行 myTable 的主键是列 id 表中没
  • TSQL - 生成文字浮点值

    我理解比较浮点数时遇到的许多问题 并对它们在这种情况下的使用感到遗憾 但我不是表格作者 只有一个小障碍需要克服 有人决定使用浮点数 就像您期望使用 GUID 一样 我需要检索具有特定浮点值的所有记录 sp help MyTable Colu
  • hive sql查找最新记录

    该表是 create table test id string name string age string modified string 像这样的数据 id name age modifed 1 a 10 2011 11 11 11 1
  • 分组和切换列和行

    我不知道这是否会被正式称为枢轴 但我想要的结果是这样的 Alex Charley Liza 213 345 1 23 111 5 42 52 2 323 5 23 1 324 5 我的输入数据采用这种形式 Apt Name

随机推荐