You need to enable JavaScript to run this app.
Database Workshop

Database Workshop

Copy page
Download PDF
Database management
Function management
Copy page
Download PDF
Function management
This topic describes how to visually create, edit, and delete functions on the DBW data interaction platform, implementing data lifecycle management of databases.​
Prerequisites​
tip​
The account you create must be granted the required permissions, for example, for querying and modifying the specified database.​
Precautions​
  • We recommend that you do not create, delete, or edit functions in the system database.​
  • Custom functions can only be used in the database connected to the current client.​
  • No custom separators are required in Function definition.​
  • Functions must have return values. Therefore, functions must not contain the select command, except when you use the select into command to assign values to multiple variables.​
  • Function deletion is irreversible. Proceed with caution.​
  • Actions such as creating or deleting objects may impact online business performance. It is recommended to perform these during off-peak hours.​
Create a function​
  1. On the top menu bar of the Data interaction platform page, click the ​​ icon next to the database and select the target database.​
  1. In the visual area of the Data interaction platform, expand the Function, right-click the target view, and select Create function.​
  1. On the Create function@{datebase name} tab, set the following parameters.​
  • ​
    Parameter​
    Description​
    Name​
    Specify a custom function name according to the following naming rules:​
    • The function name must be unique in the database.​
    • The name must be 1 to 64 characters in length, and cannot be empty.​
    • The name must start with a letter and end with a letter or a digit.​
    • The name can consist of lowercase letters, digits, underscores (_), or hyphens (-).​
    Input parameter​
    Optional. Click Input parameter to set input parameters.​
    Return type​
    From the drop-down list, select the type of the return parameter.​
    Return length​
    Set the length of the return parameter. This parameter is unavailable for some types.​
    Security​
    Specify the security context of the function. Valid values:​
    • Default: When you select this option, the security context is DEFINER by default.​
    • DEFINER: The stored procedure is executed with the permissions of the user specified by the DEFINER. When you select DEFINER, the user specified by the DEFINER must exist in the database and have the required permissions. Otherwise, the execution will fail.​
    • INVOKER: The function is executed by a user who has permission to call this function. When you select INVOKER, the execution can succeed provided that the executor has permission to execute it.​
    Data access​
    Select a data access method for the function. Valid values:​
    • Default: When you select Default, the data access method is CONTAINS SQL by default.​
    • NO SQL: The subroutine contains no SQL statements.​
    • CONTAINS SQL: The subroutine does not contain statements that read or write data.​
    • READS SQL DATA: The subroutine contains statements that read data, but not statements that write data.​
    • MODIFIES SQL DATA: The subroutine contains statements that write data.​
    Comment​
    Optional. Describe the function to help identify it.​
    ​
  1. Click Next step.​
  1. On the Create function@{datebase name} tab, go to the Function definition area, set a statement to execute the function, and click Submit.​
tip​
No custom separators are required in Function definition.​
  1. In the Execute SQL dialog box, make sure that the statement is correct and click Execute.​
Execute a function​
  1. On the top menu bar of the Data interaction platform page, click the ​​ icon next to the database and select the target database.​
  1. In the visual area of the Data interaction platform, expand the Function, right-click the target view, and select Execute function.​
  1. In the Execution function dialog box, set Parameter value and click Execute.​
  1. In the Execute SQL dialog box, make sure that the statement is correct and click Execute.​
  • After the execution is completed, in the Execution function dialog box, you can go to the Execution result area and click View result to view the execution results.​
Edit a function​
  1. On the top menu bar of the Data interaction platform page, click the ​​ icon next to the database and select the target database.​
  1. In the visual area of the Data interaction platform, expand the Function, right-click the target view, and select Edit function.​
  1. On the Edit function@{database name} tab, go to the Function definition area and edit the function statement.​
  1. Click Submit.​
  1. In the Execute SQL dialog box, make sure that the statement is correct and click Execute.​
Delete a function​
warning​
Function deletion is irreversible. Proceed with caution.​
  1. On the top menu bar of the Data interaction platform page, click the ​​ icon next to the database and select the target database.​
  1. In the visual area of the Data interaction platform, expand the Function, right-click the target view, and select Delete function.​
  1. In the Execute SQL dialog box, make sure that the statement is correct and click Execute.​
Related APIs​
​
API​
Description​
Call the DataExecCommands interface to execute an SQL command.​
Call the DataSessionKeepAlive interface to keep an SQL session alive.​
Call the DataCloseSession interface to close an SQL session.​
Call the DataCancelExec interface to cancel the execution of an SQL command.​
​
​
Last updated: 2025.09.02 18:25:10