Compare value in a procedure : Procedure « Procedure Function « SQL / MySQL






Compare value in a procedure

       

DELIMITER $$


CREATE PROCEDURE DIFFERENCE(IN P1 INTEGER,IN P2 INTEGER,OUT P3 INTEGER)
BEGIN
   IF P1 > P2 THEN
      SET P3 = 1;
   ELSEIF P1 = P2 THEN
      SET P3 = 2;
   ELSE
      SET P3 = 3;
   END IF;
END$$

DELIMITER ;

   
    
    
    
    
    
    
  








Related examples in the same category

1.Using an OUT parameter
2.Creating a Single-Statement Procedure
3.Calling a Single-Statement Procedure
4.Creating a Multistatement Stored Procedure
5.The ALTER statement lets you change the characteristics of a stored procedure
6.To remove a stored procedures, use the DROP statement
7.Calculate the power in procedure
8.Cleanup table with procedure
9.Output comparison value from a procedure
10.Find out the age with procedure
11.Syntax for Changing store procedures
12.Syntax for Creating store procedures
13.Drop table by procedure