---
title: "SQL-009: Insert IMAGE_GROUP row (conditional)"
summary: Conditionally inserts a row into IMAGE_GROUP linking an indexed image to a group, when IMAGE_FILE_CODE = "GROUP".
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Business.Imaging
reference_type: package
---

# SQL-009: Insert IMAGE_GROUP row (conditional)

This statement is conditionally executed during `clsImageIdx.BeforeInsert` as a secondary data request (`DR2`) when `IMAGE_FILE_CODE = "GROUP"`. It creates an `IMAGE_GROUP` sub-record linking the image to the specified group association.

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:ImageSeqNum` | Input | [not specified]** | N/A | Foreign key to the IMAGE row. |
| `:GroupAssociationCode` | Input | [not specified]** | 5 | The group association code. |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [IMAGE_GROUP](../database-tables.md#image_group) | INSERT | IMAGE_GROUP_SEQ_NUM, IMAGE_SEQ_NUM, GROUP_ASSOCIATION_CODE |

## Sample SQL

```sql
Insert into IMAGE_GROUP (
    IMAGE_GROUP_SEQ_NUM,
    IMAGE_SEQ_NUM,
    GROUP_ASSOCIATION_CODE
) Values (
    IMAGE_GROUP_SEQ.NEXTVAL,
    :ImageSeqNum,
    :GroupAssociationCode
)
```

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