DBMS_SESSION

Updated at:
Copy as MD

PolarDB for PostgreSQL (Compatible with Oracle) provides a partial implementation of the DBMS_SESSION package. Only DBMS_SESSION.SET_ROLE is supported.

Functions and stored procedures

Function or stored procedureReturn typeDescription
SET_ROLE(role_cmd)N/AExecutes the SET_ROLE statement followed by the string value specified in role_cmd.

SET_ROLE

Sets the current session user to the role specified in role_cmd. After the call, the session runs with the permissions assigned to that role.

Syntax

SET_ROLE(role_cmd)

Parameters

role_cmd

A string value that specifies the role name.

Example

The following call sets the current session user identity to manager:

exec DBMS_SESSION.SET_ROLE('manager');

Usage notes

DBMS_SESSION.SET_ROLE is implemented by appending role_cmd to a SET ROLE SQL statement and executing it.