---
title: "SQL-010: Insert IMAGE row"
summary: Inserts a new document image metadata record into the IMAGE table with 24 bound parameters.
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Business.Imaging
reference_type: package
---

# SQL-010: Insert IMAGE row

This is the primary insert statement for the `IMAGE` table, executed by `clsImageIdx.BeforeInsert`. It persists all image metadata including claim/policy association, document classification codes, security level, external view settings, and display fields. `AfterInsert` verifies exactly one row was affected.

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:ImageSeqNum` | Input | [not specified]** | N/A | Primary key for the IMAGE row (from SQL-002). |
| `:CreateUser` | Input | [not specified]** | 30 | User ID of the record creator. |
| `:DiscoveryFlag` | Input | [not specified]** | 1 | Discovery flag (Y/N). |
| `:DocumentDate` | Input | [not specified]** | N/A | Date of the document. |
| `:ImageCategoryCode` | Input | [not specified]** | 5 | Image category code. |
| `:ImageDocumentNameCode` | Input | [not specified]** | 5 | Document name code. |
| `:ImageDocumentTypeCode` | Input | [not specified]** | 5 | Document type code. |
| `:ImageFileCode` | Input | [not specified]** | 5 | File type code. |
| `:SecurityLevelNum` | Input | [not specified]** | N/A | Security level number. |
| `:Towid` | Input | [not specified]** | N/A | TOWID linking to the IMGSYS record. |
| `:UpdateUser` | Input | [not specified]** | 30 | User ID of the last updater. |
| `:ExternalViewCode` | Input | [not specified]** | 5 | External view code. |
| `:ExternalViewUpdateDate` | Input | [not specified]** | N/A | Date of the last external view update. |
| `:SystemGeneratedFlag` | Input | [not specified]** | 1 | Indicates if the record was system-generated (Y/N). |
| `:ClaimID` | Input | [not specified]** | N/A | Claim identifier. |
| `:ClaimNum` | Input | [not specified]** | 8 | SAIF claim number. |
| `:CommentText` | Input | [not specified]** | 256 | Comment text. |
| `:DisplayField1` | Input | [not specified]** | 256 | Display field 1. |
| `:DisplayField2` | Input | [not specified]** | 256 | Display field 2. |
| `:DisplayField3` | Input | [not specified]** | 256 | Display field 3. |
| `:DisplaySortNum` | Input | [not specified]** | N/A | Display sort order number. |
| `:ImageDeleteCode` | Input | [not specified]** | 5 | Image delete/soft-delete code. |
| `:PolicyNum` | Input | [not specified]** | N/A | Policy number. |
| `:ReceivedDate` | Input | [not specified]** | N/A | Date the document was received. |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [IMAGE](../database-tables.md#image) | INSERT | CLAIM_ID, CLAIM_NUM, COMMENT_TEXT, CREATE_DATE, CREATE_USER, DISCOVERY_FLAG, DISPLAY_FIELD_1, DISPLAY_FIELD_2, DISPLAY_FIELD_3, DISPLAY_SORT_NUM, DOCUMENT_DATE, IMAGE_CATEGORY_CODE, IMAGE_DELETE_CODE, IMAGE_DOCUMENT_NAME_CODE, IMAGE_DOCUMENT_TYPE_CODE, IMAGE_FILE_CODE, IMAGE_SEQ_NUM, POLICY_NUM, RECEIVED_DATE, SECURITY_LEVEL_NUM, TOWID, UPDATE_DATE, EXTERNAL_VIEW_CODE, EXTERNAL_VIEW_UPDATE_DATE, SYSTEM_GENERATED_FLAG, UPDATE_USER |

## Sample SQL

```sql
Insert into IMAGE (
    CLAIM_ID, CLAIM_NUM, COMMENT_TEXT,
    CREATE_DATE, CREATE_USER, DISCOVERY_FLAG,
    DISPLAY_FIELD_1, DISPLAY_FIELD_2, DISPLAY_FIELD_3, DISPLAY_SORT_NUM,
    DOCUMENT_DATE, IMAGE_CATEGORY_CODE, IMAGE_DELETE_CODE,
    IMAGE_DOCUMENT_NAME_CODE, IMAGE_DOCUMENT_TYPE_CODE, IMAGE_FILE_CODE,
    IMAGE_SEQ_NUM, POLICY_NUM, RECEIVED_DATE, SECURITY_LEVEL_NUM,
    TOWID, UPDATE_DATE,
    EXTERNAL_VIEW_CODE, EXTERNAL_VIEW_UPDATE_DATE,
    SYSTEM_GENERATED_FLAG, UPDATE_USER
) Values (
    :ClaimID, :ClaimNum, :CommentText,
    sysdate, :CreateUser, :DiscoveryFlag,
    :DisplayField1, :DisplayField2, :DisplayField3, :DisplaySortNum,
    :DocumentDate, :ImageCategoryCode, :ImageDeleteCode,
    :ImageDocumentNameCode, :ImageDocumentTypeCode, :ImageFileCode,
    :ImageSeqNum, :PolicyNum, :ReceivedDate, :SecurityLevelNum,
    :Towid, sysdate,
    :ExternalViewCode, :ExternalViewUpdateDate,
    :SystemGeneratedFlag, :UpdateUser
)
```

## Operations and processes
- [Image indexing](../operations/image-indexing.md)

> **Note:** Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `Business\SAIF.Business.Imaging\clsImageIdx.vb`
