---
title: "SQL-009: Insert user type"
summary: Inserts a new user type/role classification row into EXT_USER_TYPE.
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Business.External.Users
reference_type: package
---

# SQL-009: Insert user type

Inserts a new user type/role classification row into `EXT_USER_TYPE`, linking an external user to a source-system context with credentials and role flags.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-009 |
| **Operation type** | Create |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | Text |
| **Business object** | `clsUserType` |
| **Criteria property** | `InsertSQL` |
| **Lifecycle method** | `BeforeInsert` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:UserTypeID` | Input | Decimal | N/A | `EXT_USER_TYPE_SEQ_NUM` — primary key. |
| `:UserID` | Input | Decimal | N/A | Owning `EXT_USER_SEQ_NUM`. |
| `:UserTypeCode` | Input | String | 5 | User type code. |
| `:CustomerID` | Input | Decimal | N/A | `COMPANY_SEQ_NUM` reference. |
| `:SourceSystemID` | Input | String | 30 | `CUSTOMER_ID` (stored upper-cased). |
| `:SourceSystemGroupID` | Input | String | 30 | `CUSTOMER_GROUP_ID` (stored upper-cased). |
| `:Credential1ID` | Input | Decimal | N/A | First credential identifier. |
| `:Credential2ID` | Input | Decimal | N/A | Second credential identifier. |
| `:IsPrimaryType` | Input | String | 1 | Primary user type flag. |
| `:IsAdminUser` | Input | String | 1 | Admin user flag. |
| `:IsSteward` | Input | String | 1 | Steward designation flag. |
| `:CreateUser` | Input | String | 30 | Username creating the record. |
| `:CreateDate` | Input | DateTime | N/A | Record creation timestamp. |
| `:UpdateUser` | Input | String | 30 | Username of last update. |
| `:UpdateDate` | Input | DateTime | N/A | Last update timestamp. |
| `:UpdateNum` | Input | Decimal | N/A | Optimistic-concurrency counter. |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [EXT_USER_TYPE](../database-tables.md#ext_user_type) | INSERT | `EXT_USER_TYPE_SEQ_NUM`, `EXT_USER_SEQ_NUM`, `EXT_USER_TYPE_CODE`, `COMPANY_SEQ_NUM`, `CUSTOMER_ID`, `CUSTOMER_GROUP_ID`, `CREDENTIAL_1_ID`, `CREDENTIAL_2_ID`, `PRIMARY_TYPE_FLAG`, `ADMIN_USER_FLAG`, `STEWARD_FLAG`, `CREATE_USER`, `CREATE_DATE`, `UPDATE_USER`, `UPDATE_DATE`, `UPDATE_NUM` |

## Sample SQL

```sql
INSERT INTO EXT_USER_TYPE (
    EXT_USER_TYPE_SEQ_NUM, EXT_USER_SEQ_NUM, EXT_USER_TYPE_CODE,
    COMPANY_SEQ_NUM, CUSTOMER_ID, CUSTOMER_GROUP_ID,
    CREDENTIAL_1_ID, CREDENTIAL_2_ID, PRIMARY_TYPE_FLAG,
    ADMIN_USER_FLAG, STEWARD_FLAG,
    CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE, UPDATE_NUM
)
VALUES (
    :UserTypeID, :UserID, :UserTypeCode, :CustomerID,
    upper(:SourceSystemID), upper(:SourceSystemGroupID),
    :Credential1ID, :Credential2ID, :IsPrimaryType,
    :IsAdminUser, :IsSteward,
    :CreateUser, :CreateDate, :UpdateUser, :UpdateDate, :UpdateNum
)
```

## Operations and processes
- [User type management](../operations/user-type-management.md)

## Business rules
- [BR-EU-05: Optimistic concurrency via UPDATE_NUM](../business-rules.md#br-eu-05-optimistic-concurrency-via-update_num)

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `Business\SAIF.Business.External.Users\clsUserType.vb`
