![]() |
|
Use the CREATE ROLE statement to create a new role.
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 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.