58.15 CREATE_USER Procedure
This procedure creates a new account record in the native Oracle APEX user accounts repository.
Use this procedure to programmatically create user accounts for applications that utilize the APEX Accounts authentication scheme. To execute this procedure within the context of an APEX application, the current user must be an APEX workspace administrator and the application must permit modification of the workspace repository.
When creating workspace developer or workspace administrator users, you must also ensure that the user can authenticate to the development environment authentication scheme. The CREATE_USER procedure only creates the APEX repository user. For example, if using Database Accounts authentication, you must also run CREATE USER nnn IDENTIFIED BY yyy.
                  
Syntax
APEX_UTIL.CREATE_USER (
    p_user_id                       IN NUMBER   DEFAULT NULL,
    p_user_name                     IN VARCHAR2,
    p_first_name                    IN VARCHAR2 DEFAULT NULL,
    p_last_name                     IN VARCHAR2 DEFAULT NULL,
    p_description                   IN VARCHAR2 DEFAULT NULL,
    p_email_address                 IN VARCHAR2 DEFAULT NULL,
    p_web_password                  IN VARCHAR2,
    p_web_password_format           IN VARCHAR2 DEFAULT 'CLEAR_TEXT',
    p_group_ids                     IN VARCHAR2 DEFAULT NULL,
    p_developer_privs               IN VARCHAR2 DEFAULT NULL,
    p_default_schema                IN VARCHAR2 DEFAULT NULL,
    p_default_date_format           IN VARCHAR2 DEFAULT NULL,
    p_allow_access_to_schemas       IN VARCHAR2 DEFAULT NULL,
    p_account_expiry                IN DATE     DEFAULT TRUNC(SYSDATE),
    p_account_locked                IN VARCHAR2 DEFAULT 'N',
    p_failed_access_attempts        IN NUMBER   DEFAULT 0,
    p_change_password_on_first_use  IN VARCHAR2 DEFAULT 'Y',
    p_first_password_use_occurred   IN VARCHAR2 DEFAULT 'N',
    p_attribute_01                  IN VARCHAR2 DEFAULT NULL,
    p_attribute_02                  IN VARCHAR2 DEFAULT NULL,
    p_attribute_03                  IN VARCHAR2 DEFAULT NULL,
    p_attribute_04                  IN VARCHAR2 DEFAULT NULL,
    p_attribute_05                  IN VARCHAR2 DEFAULT NULL,
    p_attribute_06                  IN VARCHAR2 DEFAULT NULL,
    p_attribute_07                  IN VARCHAR2 DEFAULT NULL,
    p_attribute_08                  IN VARCHAR2 DEFAULT NULL,
    p_attribute_09                  IN VARCHAR2 DEFAULT NULL,
    p_attribute_10                  IN VARCHAR2 DEFAULT NULL,
    p_allow_app_building_yn         IN VARCHAR2 DEFAULT NULL,
    p_allow_sql_workshop_yn         IN VARCHAR2 DEFAULT NULL,
    p_allow_websheet_dev_yn         IN VARCHAR2 DEFAULT NULL,
    p_allow_team_development_yn     IN VARCHAR2 DEFAULT NULL );Parameters
| Parameter | Description | 
|---|---|
| p_user_id | Numeric primary key of user account. | 
| p_user_name | Alphanumeric name used for login. | 
| p_first_name | Informational. | 
| p_last_name | Informational. | 
| p_description | Informational. | 
| p_email_address | Email address. | 
| 
 | Password. | 
| p_web_password_format | If the value you are passing for the p_web_passwordparameter is in clear text format then useCLEAR_TEXT, otherwise useHEX_ENCODED_DIGEST_V2. | 
| p_group_ids | Colon separated list of numeric group IDs. | 
| p_developer_privs | Colon separated list of developer privileges. If  The following are acceptable values for this parameter: 
 
 
 Note:Currently this parameter is named inconsistently between the CREATE_USER,EDIT_USER, andFETCH_USERAPIs, although they all relate to theDEVELOPER_ROLEfield stored in the named user account record.CREATE_USERusesp_developer_privs;EDIT_USERusesp_developer_roles; andFETCH_USERusesp_developer_role. | 
| p_default_schema | A database schema assigned to the user's workspace, used by default for browsing. | 
| p_default_date_format | Oracle Date format for user. Currently only used in SQL Workshop. | 
| p_allow_access_to_schemas | Colon-separated list of schemas assigned to the user's workspace to which the user is restricted (leave NULL for all). | 
| p_account_expiry | The date the password was last updated, which defaults to today's date on creation. | 
| p_account_locked | YorNindicating if account is locked or unlocked. | 
| p_failed_access_attempts | Number of consecutive login failures that have occurred, defaults to 0on creation. | 
| p_change_password_on_first_use | YorNto indicate whether password must be changed on first use, defaults toYon creation. | 
| p_first_password_use_occurred | YorNto indicate whether login has occurred since password change, defaults toNon creation. | 
| p_attribute_01…p_attribute_10 | Arbitrary text accessible with an API. | 
| p_allow_app_building_yn | YorNto indicate whether access to App Builder is enabled. | 
| p_allow_sql_workshop_yn | YorNto indicate whether access to SQL Workshop is enabled.. | 
| 
 | YorNto indicate whether access to Websheet development is enabled. | 
| p_allow_team_development_yn | YorNto indicate whether access to Team Development is enabled. | 
Example 1
The following example creates an End User called NEWUSER1 with a password of secret99. End Users can only authenticate to developed applications.
                  
BEGIN
    APEX_UTIL.CREATE_USER(
        p_user_name    => 'NEWUSER1',
        p_web_password => 'secret99');
END;Example 2
The following example creates a Workspace Administrator called NEWUSER2 where the user NEWUSER2:
                  
- has full workspace administration and developer privilege (p_developer_privsparameter set toADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL)
- has access to 2 schemas, both their browsing default MY_SCHEMA(p_default_schemaparameter set toMY_SCHEMA) and alsoMY_SCHEMA2(p_allow_access_to_schemasparameter set toMY_SCHEMA2)
- does not have to change their password when they first login (p_change_password_on_first_useparameter set toN)
- and has their phone number stored in the first additional attribute (p_attribute_01parameter set to123 456 7890).
BEGIN
    APEX_UTIL.CREATE_USER(
        p_user_name                     => 'NEWUSER2',
        p_first_name                    => 'FRANK',
        p_last_name                     => 'SMITH',
        p_description                   => 'Description...',
        p_email_address                 => 'frank@example.com',
        p_web_password                  => 'password',
        p_developer_privs               => 'ADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL',
        p_default_schema                => 'MY_SCHEMA',
        p_allow_access_to_schemas       => 'MY_SCHEMA2',
        p_change_password_on_first_use  => 'N',
        p_attribute_01                  => '123 456 7890');
END;Parent topic: APEX_UTIL