gpt4 book ai didi

java.sql.SQLException : ORA-00604: error occurred at recursive SQL level 1 异常

转载 作者:行者123 更新时间:2023-11-30 11:39:30 25 4
gpt4 key购买 nike

我收到以下 SQL 异常,但我不知道此异常的根本原因是什么?我也正在关闭数据库连接和语句。

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

以下是我的代码:

 while(true)
{

Statement stmt2 = conn1.createStatement();
ResultSet rs2 = null;

int rec_count=0;
rs2 = stmt2.executeQuery("select count(*) as cnt from some_table");
while(rs2.next())
{
rec_count = rs2.getInt("cnt");
}

if(rec_count>0)
{
update_qry_b_trg1 = "update some_table set to_be_triggered=1,algo_status='D',dealer_id='HD001',price_trig_date=sysdate where buy_sell = 'SELL' and ordertype = 'BNLD' and to_be_triggered = 0 and algo_status = 'P' and Mod(group_ref_no,5)="+th_id;

String final_qry = "BEGIN \n"+update_qry_b_trg1+";\n"+";\n END;";

int rows = stmt1.executeUpdate(final_qry);
stmt1.close();
}

rs2.close();
stmt2.close();

}

最佳答案

无论在何处初始化 stmt1,最好在 finally block 中将其关闭。在您的情况下,您将在 if 条件下关闭它。如果条件没有通过,语句将保持打开状态,你会得到这个

java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1

此外,您还让它在 while 循环中运行,因此您需要确保关闭每个打开的语句。

关于java.sql.SQLException : ORA-00604: error occurred at recursive SQL level 1 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13249297/

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