Stored Functions
Stored functions are routines that are available in 5.x and later versions of MySQL server. A Stored function is a set of SQL commands that returns the result and can be stored in the server. Once this is done, clients do not need to keep re-issuing the individual commands but can refer to the stored function instead.
To create a new function:
- select the Database | New Object... main menu item;
- select Function in the Create New Object dialog;
- define function properties using the appropriate tabs of Function Editor.
Hint: To create a new function, you can also right-click the Functions node or any object within this node in the DB Explorer tree and select the New Function item from the context menu.
To create a new function with the same properties as one of existing functions has:
- select the Database | Duplicate Object... main menu item;
- follow the instructions of Duplicate Object Wizard.
Alternatively, you can right-click a function in the DB Explorer tree and select the Duplicate Function <function_name>... context menu item.
Duplicate Object Wizard allows you to select the database to create a new function in, and to edit the result SQL statement for creating the function.
To edit an existing function:
- select the function for editing in the DB Explorer tree (type the first letters of the function name for quick search);
- right-click the object and select the Edit Function <function_name> context menu item, or simply double-click the function;
- edit function definition using the appropriate tabs of Function Editor.
To change the name of a function:
- select the function to rename in the DB Explorer tree;
- right-click the function alias and select the Rename Function <function_name>... item from the context menu;
- edit the function name using the Rename Object... dialog.
To drop a function:
- select the function to drop in the DB Explorer tree;
- right-click the object and select the Drop Function <function_name>... context menu item;
- confirm dropping in the dialog window.
Note: If more convenient, you can also use the following shortcuts:
Ctrl+N to create a new function;
Ctrl+O to edit the selected function;
Ctrl+R to rename the function;
Shift+Del to drop the object from the database.




