By default, only the creator of a function or stored procedure can run it. However, you can use the GRANT statement to grant other users the right to run it.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
The syntax of the GRANT statement 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]
Here is an example that grants the execution privilege of the hr.log_message stored procedure to all users:
obclient> GRANT EXECUTE ON log_message TO PUBLIC;
Query OK, 0 rows affected
The following are some commonly used system privileges:
CREATE ANY PROCEDURE: the privilege to create any stored procedure.DROP ANY PROCEDURE: the privilege to drop any stored procedure.EXECUTE ANY PROCEDURE: the privilege to execute any stored procedure.
