Function
Stored functions can be registered and used in SQL for actions.
Create
- Select
"Databases"from the side menu and click"Database Name">"Functions">"Create Function". - The editor appears in the right panel.
- After describing the contents of the function, click the
"Apply"button. - When registration is complete, the created function will appear in the
"Functions"section.
Example:
USE mydb;
CREATE FUNCTION func1 (param1 int)RETURNS INTEGER DETERMINISTICBEGIN declare x int; set x = 3; RETURN param1 * x;ENDUpdate
- Select the function you wish to update by going to
Database>Functions>Function Name. - The contents of the function are displayed in the editor in the right panel.
- Correct the description of the function.
- Click the
"Apply"button.
Delete
- Select
Database>Functions>Function Name. - Select
"Delete"from the context menu. - Click the
"OK"button in the “Confirm” dialog.
Calling
Registered functions can be called with the user function SQL Function.
Calling example:
select func1(id1) from t1;