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

# SQL-002: Generate IMAGE_SEQ_NUM

This statement retrieves the next value from the `image_seq` Oracle sequence via the `DUAL` pseudo-table. It generates the primary key used when inserting a new IMAGE row during image indexing.

## Classification

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

## Parameters

No parameters.

## Tables

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

## Sample SQL

```sql
SELECT image_seq.nextval FROM DUAL
```

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