CREATE ROLE statement

The CREATE ROLE statement defines a role at the current server.

Invocation

This statement can be embedded in an application program or issued through the use of dynamic SQL statements. It is an executable statement that can be dynamically prepared only if DYNAMICRULES run behavior is in effect for the package (SQLSTATE 42509).

Authorization

The privileges held by the authorization ID of the statement must include SECADM authority.

Syntax

Read syntax diagramSkip visual syntax diagramCREATE ROLErole-name

Description

role-name
Names the role. This is a one-part name. It is an SQL identifier (either ordinary or delimited). The name must not identify an existing role at the current server (SQLSTATE 42710). The name must not begin with the characters 'SYS' and must not be 'ACCESSCTRL', 'DATAACCESS', 'DBADM', 'NONE', 'NULL', 'PUBLIC', 'SECADM', 'SQLADM', 'SCHEMAADM', or 'WLMADM' (SQLSTATE 42939).

Example

Create a role named DOCTOR.
   CREATE ROLE DOCTOR