mariadbMariadb procedure example
A MariaDB stored procedure is a set of SQL statements that can be stored in the server. It can be used to encapsulate a set of operations or logic, which can then be called from multiple client programs.
Example code
CREATE PROCEDURE example_procedure()
BEGIN
SELECT * FROM table_name;
END;
Output example
Query OK, 0 rows affected (0.00 sec)
Code explanation
CREATE PROCEDURE example_procedure()- This line creates a stored procedure namedexample_procedure.BEGIN- This line marks the beginning of the stored procedure.SELECT * FROM table_name;- This line selects all the data from the table namedtable_name.END;- This line marks the end of the stored procedure.
Helpful links
More of Mariadb
- How to get current year in Mariadb?
- Mariadb partitioning example
- How to view Mariadb error log?
- How to install Mariadb on Ubuntu?
- How to add user to Mariadb?
- How to get yesterday's date in Mariadb?
- How to use UUID in Mariadb?
- How to view Mariadb logs?
- Mariadb fulltext search example
- How to install Mariadb on Debian?
See more codes...