PolarDB-O support the following DBMS_SESSION.SET_ROLE procedure:

Function/Procedure Return type Description
SET_ROLE(role_cmd) N/A Executes the SET ROLE statement followed by the string value specified in role_cmd.

The implementation of DBMS_AQ in PolarDB databases compatible with Oracle is a partial implementation when compared with native Oracle. Only DBMS_SESSION.SET_ROLE is supported.


The SET_ROLE procedure sets the current session user to the role specified in role_cmd. After the current session invokes the SET_ROLE procedure, the session uses the permissions assigned to the specified role. The procedure has the following signature:


The SET_ROLE procedure appends the value specified for role_cmd to the SET ROLE statement, and then invokes the statement.


Parameter Description
role_cmd Specifies a role name in the form of a string value.


You can run the SET ROLE command to call the SET_ROLE procedure and set the identity of the current session user to manager. The following example shows this call:

exec DBMS_SESSION.SET_ROLE('manager');