1318 - Incorrect number of arguments for PROCEDURE

27,470

You need to reference the out parameter

CALL ModificarUsuario('6','9123','Sandra','Profesor','12345','sandru','sdf',@a)

to see result execute Select @a or Select res

Share:
27,470
andreszam24
Author by

andreszam24

Updated on June 18, 2020

Comments

  • andreszam24
    andreszam24 almost 4 years
    DROP PROCEDURE `ModificarUsuario`//
    CREATE DEFINER=`root`@`localhost` PROCEDURE `ModificarUsuario`(
       IN `Aid` INT,
       IN `Aced` VARCHAR(100),
       IN `Anombre` VARCHAR(100), 
       IN `Acargo` VARCHAR(100), 
       IN `Acedula` VARCHAR(100), 
       IN `Ausuario` VARCHAR(100),
       IN `Apass` VARCHAR(100),
       OUT `res` VARCHAR(10) )
    BEGIN
        SELECT COUNT(usuario) INTO res FROM `usuario` WHERE `cedula`=Aced and `id`<>Aid;
        IF  res =0 THEN
           UPDATE `usuario` SET cedula=Aced, nombre=Anombre, cargo=Acargo, usuario=Ausuario, contrasena=Apass WHERE cedula=Acedula;
        END IF;
    END
    

    When I use this procedure I get the error "expected 8, got 7." I don't understand this, if we look at the code there are 7 input parameters and one out parameter. It seems that the out parameter needs to be specified as well when calling the procedure, any idea why?

  • Metafaniel
    Metafaniel over 6 years
    Any idea why in MySQL Workbench 6.3 the @a value won't update? Say I have a very simple if then else in the stored procedure. I know the value should change but it remains the same when it shouldn't. Why? THANKS!
  • Jayabharathi Palanisamy
    Jayabharathi Palanisamy about 3 years
    Since proc have a output, we need to provide a temp variable to see the output