Grant Data Role

Use the GRANT DATA ROLE command to grant one or more data roles that are managed locally in the database to local end users, other data roles (that are managed locally), or application identities.

The GRANT DATA ROLE command supports two distinct use cases:

Required privilege

The GRANT ANY DATA ROLE system privilege.

Syntax

GRANT DATA ROLE [ IF EXISTS ] data_role_list
  TO grantee_list
  [ START TIME timestamp ] [ END TIME timestamp ];

data_role_list ::= data_role [, data_role ]...

grantee_list  ::= grantee [, grantee ]...

grantee       ::= { end_user | application_identity | data_role }

Parameters

Parameter Description
data_role_list A comma-separated list of data roles to be granted. Only data roles that are managed locally in the database are permitted; data roles that are externally mapped cannot be granted through this command.
grantee_list A comma-separated list of grantees. Each grantee can be a local end user, an application identity, or a data role that is managed locally.
START TIME The time stamp from which the grant becomes effective, in TIMESTAMP WITH TIME ZONE format. Optional. Not applicable when granting to an application identity.
END TIME The time stamp on which the grant becomes ineffective, in TIMESTAMP WITH TIME ZONE format. Optional. Not applicable when granting to an application identity.

Usage notes and restrictions

For syntax diagrams and additional details, see GRANT DATA ROLE in Oracle AI Database SQL Language Reference.

Example: Grant data role to end user

Grant a data role manager_role to a local end user Marvin.

GRANT DATA ROLE manager_role TO marvin;

Example: Grant one data role to another

Grant a data role employee_role to another data role manager_role, so manager_role inherits the privileges of employee_role.

GRANT DATA ROLE employee_role TO manager_role;

Example: Grant multiple data roles to multiple end users

Grant multiple data roles to multiple local end users in a single statement.

GRANT DATA ROLE hr_rep_role, it_support_role
  TO emma, jdoe;

Example: Grant data role to application identity

Grant a data role to an application identity, hcm_app.

GRANT DATA ROLE hcm_role TO hcm_app;