By default, functions and procedures can be executed by their creators only. However, the creators can use the GRANT statement to authorize other users to execute the functions and procedures.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
The syntax of GRANT is as follows:
GRANT system_privilege | role
TO user | role | PUBLIC [WITH ADMIN OPTION]
GRANT object_privilege | ALL ON schema.object
TO user | role | PUBLIC [WITH GRANT OPTION]
Example: Grant all users the privilege to execute the hr.log_message stored procedure.
obclient> GRANT EXECUTE ON log_message TO PUBLIC;
Query OK, 0 rows affected
These are frequently used system privileges:
CREATE ANY PROCEDURE: the privilege to create any stored procedures.DROP ANY PROCEDURE: the privilege to drop any stored procedures.EXECUTE ANY PROCEDURE: the privilege to execute any stored procedures.
For more information, see "Manage user privileges" in the Administrator Guide on the official website of OceanBase Database.