---
title: "SQL-007: Insert IMAGE_EAIP row (conditional)"
summary: Conditionally inserts a row into IMAGE_EAIP linking an indexed image to an EAIP period record.
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Business.Imaging
reference_type: package
---

# SQL-007: Insert IMAGE_EAIP row (conditional)

This statement is conditionally executed during `clsImageIdx.BeforeInsert` as a secondary data request (`DR2`) when the image has EAIP context (`m_EAIP.IsEAIP = True`). It links the new IMAGE row to an EAIP period by inserting a row into `IMAGE_EAIP` using an inline `IMAGE_EAIP_SEQ.NEXTVAL` expression.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-007 |
| **Operation type** | Create |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | Text** |
| **Business object** | `clsImageIdx` |
| **Criteria property** | `InsertEAIPSQL` |
| **Lifecycle method** | `BeforeInsert (conditional DR2)` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:ImageSeqNum` | Input | [not specified]** | N/A | Foreign key to the IMAGE row. |
| `:ClaimID` | Input | [not specified]** | N/A | The claim identifier associated with this EAIP period. |
| `:EAIPPeriodSeq` | Input | [not specified]** | N/A | The EAIP period sequence number. |
| `:ClaimOpenDate` | Input | [not specified]** | N/A | The EAIP period effective date (claim open date). |
| `:CreateUser` | Input | [not specified]** | 30 | User ID of the record creator. |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [IMAGE_EAIP](../database-tables.md#image_eaip) | INSERT | IMAGE_EAIP_SEQ_NUM, IMAGE_SEQ_NUM, CLAIM_ID, EAIP_PERIOD_SEQ_NUM, CLAIM_OPEN_DATE, CREATE_DATE, CREATE_USER |

## Sample SQL

```sql
Insert into IMAGE_EAIP (
    IMAGE_EAIP_SEQ_NUM,
    IMAGE_SEQ_NUM,
    CLAIM_ID,
    EAIP_PERIOD_SEQ_NUM,
    CLAIM_OPEN_DATE,
    CREATE_DATE,
    CREATE_USER
) Values (
    IMAGE_EAIP_SEQ.NEXTVAL,
    :ImageSeqNum,
    :ClaimID,
    :EAIPPeriodSeq,
    :ClaimOpenDate,
    sysdate,
    :CreateUser
)
```

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