FOR Select MYSQL Database

Asked

Viewed 36 times

0

I need to do this same process below in Mysql;

create or alter procedure SP_ATUALIZA_ESTOQUE_COMPOSICAO (
    CODEMP integer,
    CODPRO integer,
    QUANT numeric(18,3),
    CODLOCAL integer)
as
declare variable VL_CODIGO integer;
declare variable VL_QUANT numeric(18,3);
BEGIN
    FOR SELECT COD_PRO_COMPOSICAO, QUANT
        FROM PRODUTOS_COMPOSICAO
        WHERE COD_PRO = :CODPRO
        ORDER BY COD_PRO_COMPOSICAO
        INTO :VL_CODIGO, :VL_QUANT
    DO
      BEGIN
         EXECUTE PROCEDURE SP_ATUALIZA_ESTOQUE(:CODEMP, :VL_CODIGO, (:VL_QUANT * :QUANT), :CODLOCAL);
      END
 END

But I’m not getting it because of FOR SELECT, I’ve always worked with Firebird and now I’m in a project using Mysql, can someone give me a tip on how to do?

  • FOR SELECT as well as the FOR of Oracle is a cursor, search for CURSOR in the Mysql and you’ll be able to carry the code

No answers

Browser other questions tagged

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