Stored Procedure in MySQL

Stored Procedure in MySQL

A Stored procedure is a collection of pre-compiled SQL statements stored inside the database. A procedure always contains a name, parameter lists, and SQL statements. Stored Procedure increases the performance of the applications. Once stored procedures are created, they are compiled and stored in the database and have the following advantages:

  • Code reusability.
  • Lesser Network transfer.
  • More secure
  • Modularized code structure.

How to create a procedure?

DELIMITER &&  

CREATE PROCEDURE procedure_name [[IN | OUT | INOUT] parameter_name datatype [, parameter datatype])]    

BEGIN    

    Declaration section    

    Executable section    

END &&  

DELIMITER;   

How to call a stored procedure?

CALL procedure_name ( parameter(s))  

Post Your Comments & Reviews

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

*

*