---
title: "SQL-017: Retrieve IMAGE_AFFILIATION by sequence"
summary: Retrieves a single IMAGE_AFFILIATION row by its primary key (IMAGE_AFFILIATION_SEQ_NUM).
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Business.Imaging
reference_type: package
---

# SQL-017: Retrieve IMAGE_AFFILIATION by sequence

This statement retrieves a single `IMAGE_AFFILIATION` row filtered by `IMAGE_AFFILIATION_SEQ_NUM`. It is executed by `clsImageAffiliation.BeforeRetrieve` to load an existing affiliation record.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-017 |
| **Operation type** | Read |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | Text** |
| **Business object** | `clsImageAffiliation` |
| **Criteria property** | `RetrieveSQL` |
| **Lifecycle method** | `BeforeRetrieve` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:ImageAffiliationSeqNum` | Input | [not specified]** | N/A | Primary key of the IMAGE_AFFILIATION row to retrieve. |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [IMAGE_AFFILIATION](../database-tables.md#image_affiliation) | SELECT | AFFILIATION_IMAGE_SEQ_NUM, CREATE_DATE, CREATE_USER, IMAGE_AFFILIATION_SEQ_NUM, IMAGE_SEQ_NUM |

## Sample SQL

```sql
Select
    IMAGE_AFFILIATION.AFFILIATION_IMAGE_SEQ_NUM as AffiliationImageSeqNum,
    IMAGE_AFFILIATION.CREATE_DATE as CreateDate,
    IMAGE_AFFILIATION.CREATE_USER as CreateUser,
    IMAGE_AFFILIATION.IMAGE_AFFILIATION_SEQ_NUM as ImageAffiliationSeqNum,
    IMAGE_AFFILIATION.IMAGE_SEQ_NUM as ImageSeqNum
From IMAGE_AFFILIATION
Where IMAGE_AFFILIATION.IMAGE_AFFILIATION_SEQ_NUM = :ImageAffiliationSeqNum
```

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

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

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