CREATE USER statement 

The CREATE USER statement defines a user. The existence and the properties of the user are recorded in the catalog in the form of metadata.

Syntax

<create_user_statement> ::= CREATE USER <user_name> PASSWORD <password>
[<user_mode>] [PERMLIMIT <unsigned_integer>] [TEMPLIMIT <unsigned_integer>]
[TIMEOUT <unsigned_integer>] [COSTWARNING <unsigned_integer>] [COSTLIMIT <unsigned_integer>] [[NOT] EXCLUSIVE]
| CREATE USER <user_name> PASSWORD <password> LIKE <source_user>
| CREATE USER <user_name> PASSWORD <password> USERGROUP <usergroup_name>

user_name, user_mode, unsigned_integer, usergroup_name

Explanation

The current user must be a DBA user. The user is the owner of the created user.

The specified user name must not be identical to the name of an existing user, usergroup, or role.

The password must be specified when an database session is started. It ensures that only authorized users can access the database system.

Unsigned integers must always be greater than 0.

User class ( user_mode)

If no user class or if STANDARD is specified, PERMLIMIT must not be used.

PERMLIMIT may be used if the user class DBA or RESOURCE was specified.

PERMLIMIT

If PERMILIMIT is specified, the disk space available for users' private tables is limited. This value is specified in units of 8 KB.

If PERMLIMIT is not specified, the user has unlimited space (within the limits of the sizes of the data devspaces specified during the installation) for storing private tables.

TEMPLIMIT

If PERMILIMIT is specified, the disk space available to this user for building temporary result tables, temporary base tables, and for execution plans is limited. This value is specified in units of 8 KB.

If TEMPLIMIT is not specified, the user has unlimited space (within the limits of the sizes of the data devspaces specified during the installation).

TIMEOUT

The TIMEOUT value defines the maximum time that may elapse between the completion of an SQL statement and the issuing of the next SQL statement. This value is the maximum value which can be specified as a TIMEOUT value in the CONNECT statement.

The TIMEOUT value is specified in seconds and must be between 30 and 32400.

COSTWARNING/COSTLIMIT

COSTWARNING and COSTLIMIT limit costs by preventing users from executing query statements or insert statements in the form of INSERT...SELECT... beyond a specified degree of complexity.

Before these SQL statements are executed, the costs expected to result from this statement are estimated. This SELECT costs estimate can be output with the EXPLAIN statement. In interactive mode, the estimated SELECT cost value is compared with the COSTWARNING and COSTLIMIT values specified for the user.

The COSTWARNING and COSTLIMIT values are ignored with query statements or insert statements in the form INSERT...SELECT... which are embedded in a programming language.

COSTWARNING: specifies the estimated SELECT cost value beyond which the user receives a warning. In this case, the user is asked whether the SQL statement is to be executed.

COSTLIMIT: specifies the estimated SELECT cost value beyond which the SQL statement is not executed.

The COSTLIMIT value must be greater than the COSTWARNING value.

EXCLUSIVE

EXCLUSIVE: prevents the user from opening two different database sessions simultaneously.

NOT EXCLUSIVE: allows the user to open several database sessions simultaneously.

If the EXCLUSIVE condition is not specified, EXCLUSIVE is assumed implicitly (without NOT).

LIKE

The current user must have owner authorization over the source user.

If the source user is not a member of a usergroup, the new user receives the same user class and values for PERMLIMIT, TEMPLIMIT, TIMEOUT, COSTWARNING, COSTLIMIT, and EXCLUSIVE as the source user. The new user receives all the privileges that the source user was granted by other users.

If the source user is a member of a usergroup, a new member is created in this usergroup with the new user name.

USERGROUP

The user issuing the SQL statement must be the owner of the specified usergroup. The new user then becomes a member of this usergroup.