Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MySQL存储过程,光标未打开(1326)_Mysql_Sql_Stored Procedures - Fatal编程技术网

MySQL存储过程,光标未打开(1326)

MySQL存储过程,光标未打开(1326),mysql,sql,stored-procedures,Mysql,Sql,Stored Procedures,因此,我正在尝试获得有关SELECT请求的一些结果,但每次我尝试调用该过程时,它都会给我: mysql> call canIDoThisSequenceSire(38,18); ERROR 1326 (24000): Cursor is not open 我不知道为什么,我想我的光标是正确打开的,我在其他存储过程中使用了这种代码框架,它工作得很好,在试图找到有类似错误的人之后,我只找到了没有使用开放卷曲线的人 这是密码 PROCEDURE `canIDoThisSequenceSire`

因此,我正在尝试获得有关SELECT请求的一些结果,但每次我尝试调用该过程时,它都会给我:

mysql> call canIDoThisSequenceSire(38,18);
ERROR 1326 (24000): Cursor is not open
我不知道为什么,我想我的光标是正确打开的,我在其他存储过程中使用了这种代码框架,它工作得很好,在试图找到有类似错误的人之后,我只找到了没有使用开放卷曲线的人

这是密码

PROCEDURE `canIDoThisSequenceSire`(in idOpe INT, in idSeq INT)
BEGIN

DECLARE done INT default FALSE;
DECLARE isRoot,seqParent, seqDone INT;


DECLARE curl CURSOR FOR SELECT 
    se.isRoot, se.id_sequenceEnchainement
    FROM 
        tachesrealisees as tr
    JOIN
        collectiontache as ct
    ON
        ct.id = tr.id_collectiontache
    JOIN
        tache as t
    ON
        t.id=ct.id_tache
    JOIN 
        sequences as s
    ON 
        s.id = ct.id_sequences
    JOIN
        sequenceenchainement as se
    ON
        se.id_sequence=s.id
    WHERE 
        tr.id_operationsrealisees=idOpe
    AND 
        s.id=idSeq;

DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

OPEN curl;


laBoucle : LOOP
    FETCH curl INTO isRoot, seqParent;
    IF isRoot THEN
        SET done = TRUE;
        LEAVE laBoucle;
    END IF;

    IF ISNULL(isRoot) then
        LEAVE laBoucle;
    END IF;

    CLOSE curl;

    END LOOP laBoucle;

    IF done THEN -- La séquence est à la racine
        SELECT 1 as result; 
    END IF;

    IF NOT done THEN 
            SELECT 0 as result; -- Please, come again
    END IF;

END

谢谢

您正在关闭循环中的光标

... 如果ISNULLisRoot,那么 离唇; 如果结束; -紧密卷曲; 末端环; 紧密卷曲; ...
谢谢,我觉得自己很笨