DECLARE CONTINUE HANDLER FOR NOT FOUND

Domenika's profile image Domenika posted 5 years ago in General Permalink

Hi, I'm trying to use DECLARE CONTINUE HANDLER FOR NOT FOUND on the following way:

DECLARE Var_Finished INTEGER DEFAULT 0;

DECLARE CONTINUE HANDLER FOR NOT FOUND

Begin

SET Var_Finished = 1;

END;

OPEN Main_Cursor;

Main_loop: LOOP

REPEAT

    FETCH Main_Cursor 
    INTO Var_ID_Elaborazione,Var_Versione,-- 01.0.10000
    Var_ID_Inizio,Var_ID_Fine,Var_Origine,Var_Category_ID,Var_Copia,
    Var_Decimali_Consumo,Var_Decimali_Percentuale,Var_UnitaMisura,Var_Soglia_Minimo_Consumo;

    Select Var_Finished FROM HE_DataLake_Disaggregato_OutBound_Elaborazioni
    WHERE ID_Elaborazione=Var_ID_Elaborazione;

    IF Var_Finished = 1 THEN LEAVE Main_loop;
    END IF;

UNTIL Var_Finished END REPEAT;

END Loop Main_loop;

CLOSE Main_Cursor;

END

It works. The problem is that process one line at a time. It seems to me that doesn't see the LOOOP

Please login to leave a reply, or register at first.