存储过程的递归限制0

cdmah0mi  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(346)

这个问题在这里已经有了答案

在非递归过程中超过递归限制(1个答案)
两年前关门了。
当我试图调用c#中的存储过程时。这是回报:
例程delete\u medikalislem超过递归限制0(由max\u sp\u recursion\u depth变量设置)
删除medikalislem程序:

DELETE FROM medikal WHERE islem_id = p_id;

存储参数:name:p\u id,type:varchar,length:25

using (MySqlConnection connect = new MySqlConnection(connectionString))
           {
             using (MySqlCommand cmd = new MySqlCommand(mw.db_name+ ".delete_medikalislem", connect))
                 {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("p_id", mw.medikalislem[0]);
                    connect.Open();
                    cmd.ExecuteNonQuery();
                    connect.Close();
                 }
            }

i使用后删除触发器:

BEGIN

DECLARE tl_ integer default 0;
DECLARE usd_ integer default 0;
DECLARE eur_ integer default 0;
DECLARE gbp_ integer default 0;
DECLARE toplam_ integer default 0;

SELECT tl, usd, eur, gbp INTO tl_, usd_, eur_, gbp_ FROM medikalfirmalar WHERE isim = OLD.medikal_isim;
DELETE FROM medikal_caritahsilat WHERE islem_id = OLD.islem_id;
    IF (OLD.birim='TL') THEN
    SET toplam_= tl_ - OLD.tutar;
    UPDATE medikalfirmalar SET tl = toplam_ WHERE isim = OLD.medikal_isim;
    END IF;
    IF (OLD.birim='USD') THEN
    SET toplam_= usd_ - OLD.tutar;
    UPDATE medikalfirmalar SET usd = toplam_ WHERE isim = OLD.medikal_isim;
    END IF;
    IF (OLD.birim='EUR') THEN
    SET toplam_= eur_ - OLD.tutar;
    UPDATE medikalfirmalar SET eur = toplam_ WHERE isim = OLD.medikal_isim;
    END IF;
    IF (OLD.birim='GBP') THEN
    SET toplam_= gbp_ - OLD.tutar;
    UPDATE medikalfirmalar SET gbp = toplam_ WHERE isim = OLD.medikal_isim;
    END IF;
END

我该怎么修?

gdrx4gfi

gdrx4gfi1#

它只是sql在抱怨递归性。
你必须明确地告诉它递归可以有多少层。
在程序开始时添加以下内容:

SET max_sp_recursion_depth=255;

相关问题