MySQL Error - Stored Procedures

1

I'm creating this procedure to run once a day, as I have no experience, I got an error in the code below:

    CREATE (definer omitido) PROCEDURE 'MULTAOFF'()
    BEGIN 


    set @multado = (select 'CPFAluno' from multa where 'dataMultaFim' <= 
    CURDATE());

    update aluno set 'StatusAluno' = '0' where @multado IN ('CPF') and 
    StatusAluno = '2';

    END

As a result of calling Call MULTAOFF(); I get the following error:

Error Code: 1242. Subquery returns more than 1 row

What is happening and how can I resolve this?

    
asked by anonymous 07.11.2017 / 13:22

1 answer

1

Your error is in your subquery, so try changing your procedure accordingly.

CREATE (definer omitido) PROCEDURE 'MULTAOFF'()
BEGIN 

UPDATE aluno SET 'StatusAluno' = '0' where  CPF and 
StatusAlunos IN (select 'CPFAluno' from multa where 'dataMultaFim' <= 
CURDATE());

END
    
07.11.2017 / 13:30