Problem with cursor in Mysql

Asked

Viewed 571 times

1

Good afternoon!

I am successfully creating the following cursor:

declare v_cursor cursor for
    select idCliente, max(dataVenda) from Cliente
    left join Venda on idCliente = cliente_idCliente
    group by idCliente;

But when executing the command fetch I get the following error:

Error code 1329, SQL state 02000: No date - zero fetched Rows, Selected, or processed

Apparently he accuses the select did not return any tuple to the cursor. However, when I execute the select isolated, it returns data:

inserir a descrição da imagem aqui

Can anyone tell me why this happens?

There is a way around this problem?

Thank you!

1 answer

2


  • 1

    Actually, I had forgotten to declare Handler! vlw

Browser other questions tagged

You are not signed in. Login or sign up in order to post.