MariaDB procedure is a stored program that is used to pass parameters into it. It does not return a value like a function does.
You can create and drop procedures like functions.
You can create your procedure just like you create a function in MariaDB.
DEFINER clause: Optional.
procedure_name: The name to assign to this procedure in MariaDB.
Parameter: One or more parameters passed into the procedure. When creating a procedure, there are three types of parameters that can be declared:
IN: The parameter can be referenced by the procedure. The value of the parameter can not be overwritten by the procedure.
OUT: The parameter can not be referenced by the procedure, but the value of the parameter can be overwritten by the procedure.
IN OUT: The parameter can be referenced by the procedure and the value of the parameter can be overwritten by the procedure.
LANGUAGE SQL: It is in the syntax for portability but will have no impact on the function.
DETERMINISTIC: It means that the function will always return one result given a set of input parameters.
NOT DETERMINISTIC: It means that the function may return a different result given a set of input parameters. The result may be affected by table data, random numbers or server variables.
CONTAINS SQL: It is the default. It is an informative clause that tells MariaDB that the function contains SQL, but the database does not verify that this is true.
NO SQL: It is an informative clause that is not used and will have no impact on the function.
READS SQL DATA: It is an informative clause that tells MariaDB that the function will read data using SELECT statements but does not modify any data.
MODIFIES SQL DATA: It is an informative clause that tells MariaDB that the function will modify SQL data using INSERT, UPDATE, DELETE, or other DDL statements.
declaration_section: The place in the procedure where you declare local variables.
executable_section: The place in the procedure where you enter the code for the procedure.
Create a procedure named "CalcValue" in MariaDB database.
You can now see that procedure named "CalcValue" is created .
You can reference your new procedure as follows:
MariaDB DROP Procedure
You can drop procedure by using the following command:
procedure_name: It specifies the name of the procedure that you want to drop.
You can see that procedure is dropped now and it is not available in the list.