informix
Informix Guide to SQL: Syntax
SQL Statements

CREATE ROLE

Use the CREATE ROLE statement to create a new role.

Syntax

Element Purpose Restrictions Syntax
role Name assigned to a role created by the DBA In Dynamic Server, the maximum number of bytes in role is 32. In Enterprise Decision Server, the maximum number of bytes in role is 8. A role name cannot be a user name known to the database server or the operating system of the database server. A role name cannot be in the username column of the sysusers system catalog table or in the grantor or grantee columns of the systabauth, syscolauth, sysprocauth, sysfragauth, and sysroleauth system catalog tables. When a role name is enclosed in quotation marks, the role name is case sensitive. Identifier, p. 4-205

Usage

The database administrator (DBA) uses the CREATE ROLE statement to create a new role. A role can be considered as a classification, with privileges on database objects granted to the role. The DBA can assign the privileges of a related work task, such as engineer, to a role and then grant that role to users, instead of granting the same set of privileges to every user.

After a role is created, the DBA can use the GRANT statement to grant the role to users or to other roles. When a role is granted to a user, the user must use the SET ROLE statement to enable the role. Only then can the user use the privileges of the role.

The CREATE ROLE statement, when used with the GRANT and SET ROLE statements, allows a DBA to create one set of privileges for a role and then grant the role to many users, instead of granting the same set of privileges to many users.

A role exists until either the DBA or a user to whom the role was granted with the WITH GRANT OPTION uses the DROP ROLE statement to drop the role.

To create the role engineer, enter the following statement:

Related Information

Related statements: DROP ROLE, GRANT, REVOKE, and SET ROLE

For a discussion of how to use roles, see the Informix Guide to Database Design and Implementation.


Informix Guide to SQL: Syntax, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved