EMS logo

Products Navigation

SQL Manager for MySQL

Our Partnership Status

Microsoft Certified Partner
Oracle Certified Partner
Embarcadero Technology Partner

EMS SQL Manager for MySQL

On-line Documentation

Creating/editing function


Use the Edit tab of Function Editor to create/edit a stored function and specify its definition.

 

Name

Enter a name for the new function, or view the name of the function being edited.

 

Function Editor - Editing function definition

 

 

Returns

Use the drop-down list to select the return type of the function. Note that the function body must contain a RETURN statement.

 

Definer

Specifies the MySQL account to be used when checking access privileges at the function execution time (if Definer is selected in the SQL security group).

Hint: You should either follow the 'user_name'@'host_name' format, or select the CURRENT_USER value to use the current MySQL user as the routine definer.

 

Function type

RadioButton Deterministic (indicates that the function always produces the same result for the same input parameters)

RadioButton Not deterministic (indicates that the function does not produce the same result for the same input parameters)

 

SQL security

Specify whether the function should be executed using the permissions of:

RadioButton Definer (the user that creates the routine), or

RadioButton Invoker (the user that invokes the routine)

 

SQL Data Access

Use the drop-down list to specify the nature of data use by the function:

CONTAINS SQL (i.e. the routine does not contain statements that read or write data)

NO SQL (i.e. the routine contains no SQL statements)

READS SQL DATA (i.e. the routine contains statements that read data (e.g. SELECT), but not statements that modify data)

MODIFIES SQL DATA (i.e. the routine contains statements that may write data, e.g. INSERT, DELETE)

 

 

The Parameters list provides the following attributes of each parameter used in the procedure:

Set the procedure parameters by right-clicking within the list and selecting iconPlus Add Parameter. Set all necessary settings for the  parameter in the opened dialog window.

 

Function Editor - Editing function definition - Add new parameter

 

Name

Data Type - the type of the parameter data.

Use the Data size spinner control to define the size of the parameter value.

Use the Precision spinner control to define the precision of the parameter value (for float data types). The precision indicates the number of significant digits.

Enum values - values of the ENUM datatype.

 

CheckBox Use database charset.

 

If you need different charset, you can select it from the Character set drop down list.

 

CheckBox Unsigned

Assigns the UNSIGNED attribute to the field: integer data will be displayed unsigned.

 

CheckBox Zerofill

Assigns the ZEROFILL attribute to the field: for columns of the numeric data type, MySQL will automatically add zeros before the first significant digit of the number stored in this column.

 

 

To delete the existing parameter, select iconMinus Delete Parameter from the popup menu. To edit parameter double-click it.

Hint: You can reorder parameters in the list using the Move Up and Move Down popup menu items.

 

 

Definition

This area allows you to set the function definition (body).

 

For your convenience the syntax highlight, code completion and a number of other features for efficient SQL editing are implemented. For details see Working with SQL Editor area and Using the context menu.

 

 

To execute the function, you can use the btnExecuteQuery Execute function item available within the Navigation bar.