Stored Procedure com if

Asked

Viewed 971 times

2

I have a table with the fields name, id and salary.

I need a trial that changes the employee’s salary, if she receives one, should increase the salary by 300 reais, in case another value decreases the salary by 500 reais.

You know how it can be done?

1 answer

3


Imagine that the resolution is something along these lines:

DELIMITER $$

CREATE PROCEDURE AumentarSalario(IN quantidade INT, codigoFuncionario INT)
BEGIN
    IF quantidade = 1 THEN
            <update que aumenta salario em 300 usando o codigoFuncionario recebido>
    ELSE
            <update que aumenta salario em 500 usando o codigoFuncionario recebido>
    END IF
END $$
DELIMITER ;

I left space for the commands to be inserted because I am not sure of the bank structure and have received few details.

  • I have a table with field id and product name and value, I need a Function that receives by parameter the product id and the percentage of increase in product value and then return me the current value of the changed product

  • This doubt must be asked in another question, but it does not seem that you are trying.

  • yes but I can only publish every 40 minutes help me there bro life or death!!! @Luizsantos help me please

  • released, but I advise to try more, before asking for the solution.

  • I’m making a test becomes difficult kkkkk

Browser other questions tagged

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