---
title: "SQL-001: Generate IMAGE_AFFILIATION_SEQ_NUM"
summary: Retrieves the next value from the IMAGE_AFFILIATION_SEQ Oracle sequence to generate a primary key for a new IMAGE_AFFILIATION row.
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Business.Imaging
reference_type: package
---

# SQL-001: Generate IMAGE_AFFILIATION_SEQ_NUM

This statement retrieves the next value from the `IMAGE_AFFILIATION_SEQ` Oracle sequence via the `DUAL` pseudo-table. It generates the primary key used when inserting a new `IMAGE_AFFILIATION` row.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-001 |
| **Operation type** | Sequence |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | SYS (DUAL) |
| **Command type** | Text** |
| **Business object** | `clsImageAffiliation` |
| **Criteria property** | `CreateSQL` |
| **Lifecycle method** | `BeforeCreate` |

## Parameters

No parameters.

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [DUAL](../database-tables.md#dual) | SELECT (NEXTVAL) | IMAGE_AFFILIATION_SEQ.NEXTVAL |

## Sample SQL

```sql
SELECT IMAGE_AFFILIATION_SEQ.NEXTVAL FROM DUAL
```

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