MySQL stored procedure parameters and variables

MySQL CASE

All the stored procedure needs parameters to make more flexible. It has one of these three modes i.e. IN, OUT or INOUT.

IN: Default mode i.e. calling program has to pass an argument to the stored procedures and value of IN parameter is changed inside of stored procedure even after stored procedure ends, the values is retained.

OUT: OUT parameter value can be changed inside of stored procedures and new value passed back to the calling program.

INOUT: Combination of IN and OUT.

To hold stored procedures result we can use variables.

To declare a variable:

DECLARE total_price INT(11) DEFAULT 0;

You can assign value to variable using SET statement:

SET total_price = 250;

For any types of queries, you can contact us on info@namasteui.com.

Leave a Reply

Your email address will not be published. Required fields are marked *