Procedure multiply

Asked

Viewed 159 times

0

I need to help solve a problem,

Code:

DELIMITER $$
create procedure sp_ptopedido( TPOMEDIOREPOS int, DEMANDA int, ESTOQUEMINIMO int),
begin

    PONTOPEDIDOTOPEDIDO = ((TPOMEDIOREPOS / 30) * DEMANDA) + ESTOQUEMINIMO FROM produto;

END $$
DELIMITER ;

I get this error when executing the command:

SQL command:

create procedure sp_ptopedido( TPOMEDIOREPOS int, DEMANDA int, ESTOQUEMINIMO int),
begin

    PTOPEDIDO = ((TPOMEDIOREPOS / 30) * DEMANDA) + ESTOQUEMINIMO FROM produto;

END

Mysql Messages : Documentation

#1064 - You have an error in your SQL syntax; check the manual that Corresponds to your Mariadb server version for the right syntax to use near ' Begin

    PTOPEDIDO = ((TPOMEDIOREPOS / 30) * DEMANDA) + ESTOQUEMINIMO ' at line 1
  • 2

    Ola Maria, you could be more specific about the problem, explain more about it and add more details, it would help. Make a tour also to learn how the site works.

  • oi Dener, this precedent would do this calculation:Order Point = [(Replacement Time/30) * Demand] + Minimum Stock.

  • Then I tried to make that code, but it’s making a mistake.

  • the fields DEMAND, STOCK AND TPOMEDIOREPOS are from the same table, products.

  • Which error is giving? Could edit the question and put the errors?

  • Which language is also used?

  • Mysql, I’m doing in phpMyAdmim

  • 1

    There is an extra comma after the "(" of create Procedure. Furthermore, you do nothing with this routine other than assign a value to a non-existent variable (PTO request) and return nothing to anyone. This trial, inclusive, seems to me totally unnecessary to accomplish something so simple, probably what you want to do is run an UPDATE. If you edited the question explaining your problem, you could get better help.

Show 3 more comments
No answers

Browser other questions tagged

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