---
title: "SQL-031: Retrieve all user type definitions"
summary: Retrieves all user type code definitions from EXT_USER_TYPE_CODE with prompt labels.
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Business.External.Users
reference_type: package
---

# SQL-031: Retrieve all user type definitions

Retrieves all user type code definitions from `EXT_USER_TYPE_CODE` joined to `EXT_USER_TYPE_CODE_PROMPT` for the customer-ID prompt label, ordered by code. Used by `GetAllUserTypes`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-031 |
| **Operation type** | Read |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | Text |
| **Business object** | `clsUserType` |
| **Criteria property** | Local SQL |
| **Lifecycle method** | `GetAllUserTypes` |

## Parameters

This statement has no bind parameters.

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [EXT_USER_TYPE_CODE](../database-tables.md#ext_user_type_code) | SELECT | `CODE`, `CUSTOMER_ID_DESCR`, `CUSTOMER_GROUP_ID_DESCR` |
| [EXT_USER_TYPE_CODE_PROMPT](../database-tables.md#ext_user_type_code_prompt) | JOIN | `EXT_USER_TYPE_CODE`, `PROMPT_CODE`, `PROMPT_DESCR` |

## Sample SQL

```sql
SELECT
    -1 AS UserTypeID,
    -1 AS UserID,
    c.Code AS UserTypeCode,
    CASE WHEN c.customer_id_descr <> c.customer_group_id_descr
         THEN 'Y' ELSE 'N'
    END AS UseCustomerGroupID,
    null AS CustomerID,
    null AS SourceSystemID,
    null AS SourceSystemGroupID,
    c.CUSTOMER_ID_DESCR AS SourceSystemIDDescription,
    cd.PROMPT_DESCR AS SourceSystemIDPrompt,
    c.CUSTOMER_GROUP_ID_DESCR AS SourceSystemGroupIDDescription,
    null AS Credential1ID,
    null AS Credential2ID,
    'N' AS IsPrimaryType,
    'N' AS IsAdminUser,
    'N' AS IsSteward,
    null AS CreateUser,
    null AS CreateDate,
    'NONE' AS UpdateUser,
    sysdate AS UpdateDate,
    -1 AS UpdateNum,
    'N' AS HasConflictClaim
FROM EXT_USER_TYPE_CODE c
JOIN ext_user_type_code_prompt cd
    ON c.code = cd.ext_user_type_code AND cd.prompt_code = 'CUSID'
ORDER BY c.code
```

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

> **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`
