Stored Routines

MySQL stored routines are preset, stored batches of SQL statements to be called upon as needed.

ALTER EVENT

Use this MySQL statement to alter an existing scheduled MySQL event.

This MySQL statement changes the characteristics of an existing user-defined function.

This MySQL statement changes the characteristics of an existing stored procedure.

There is not an ALTER TRIGGER statement in MySQL at this time.

BEGIN...END

Use this combination of MySQL statements to start and end the steps that are part of a stored procedure or trigger.

CALL

Use this MySQL statement to call a stored procedure.

CLOSE

This MySQL statement closes a cursor that has been declared within the current routine and has been opened using the OPEN statement.

CREATE EVENT

Use this MySQL statement to schedule the execution of an SQL statement at a specific time and date.

CREATE FUNCTION

A user-defined function is in essence a set of MySQL statements that may be called as a unit, processing any data it's given in its parameters and returning a value to the caller of the function.

CREATE PROCEDURE

A procedure, also known as a stored procedure, is set of MySQL statements stored on the MySQL server and called as a unit, processing any data it's given in its parameters.

CREATE TRIGGER

Triggers are actions to be taken when a user requests a change to data in MySQL.

DECLARE

This MySQL statement declares local variables and other items related to routines.

DELIMITER

This MySQL statement changes the delimiter (terminating character) of SQL statements from the default of a semi-colon to another character.

DROP EVENT

This MySQL statement deletes an event.

DROP FUNCTION

Use this MySQL statement to delete a user-defined function.

DROP PREPARE

This MySQL statement deletes a prepared statement.

DROP PROCEDURE

This MySQL statement deletes a stored procedure.

DROP TRIGGER

This MySQL statement deletes a trigger.

EXECUTE

This MySQL statement executes a user-defined prepared statement.

FETCH

A cursor is similar to a MySQL table or a view: it represents, within a procedure, a results set that is retrieved one row at a time using this MySQL statement.

OPEN

This MySQL statement opens a cursor that has been declared within the current routine.

PREPARE

This MySQL statement creates a prepared statement.

SHOW CREATE EVENT

This MySQL statement displays an SQL statement that can be used to create an event like the one given.

SHOW CREATE FUNCTION

This MySQL statement displays an SQL statement that can be used to create a function like the one given.

SHOW CREATE PROCEDURE

This MySQL statement displays an SQL statement that can be used to create a stored procedure like the one given.

SHOW EVENTS

This MySQL statement displays a list of scheduled events on the server.

SHOW FUNCTION CODE

This MySQL statement displays the internal code of a function.

SHOW FUNCTION STATUS

This MySQL statement displays information on user-defined functions.

SHOW PROCEDURE CODE

This MySQL statement displays the internal code of a stored procedure.

SHOW PROCEDURE STATUS

This MySQL statement displays information on stored procedures.

SHOW TRIGGERS

This MySQL statement displays a list of triggers on the server.