---
title: "SQL-038: clsIndexBatch"
summary: Update statement for clsIndexBatch.
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Business.Imaging
reference_type: package
---

# SQL-038: clsIndexBatch

This statement updates the scan date (`SCANDT`), batch ID (`BATID`), update timestamp (`UPDTTS`), and updater ID (`UPDRID`) for `IMGSYS` rows that are not indexed and not deleted, matching the original batch ID. It uses a CASE expression on `:BatchIdOrig1`/`:BatchIdOrig2` to handle null batch IDs as a space-padded match. Executed by `clsIndexBatch.BeforeUpdate`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-038 |
| **Operation type** | Update |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | Text** |
| **Business object** | `clsIndexBatch` |
| **Criteria property** | `UpdateSQL` |
| **Lifecycle method** | `BeforeUpdate` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:ScanDate` | Input | [not specified]** | N/A | New scan date value. |
| `:BatchId` | Input | [not specified]** | 15 | New batch ID to set. |
| `:UpdrId` | Input | [not specified]** | 15 | Updater user ID. |
| `:BatchIdOrig1` | Input | [not specified]** | 15 | Original batch ID (null check for CASE expression). |
| `:BatchIdOrig2` | Input | [not specified]** | 15 | Original batch ID (CASE branch value). |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [IMGSYS](../database-tables.md#imgsys) | UPDATE | SCANDT, BATID, UPDTTS, UPDRID (WHERE: IDXFL, BATID, DELCD) |

## Sample SQL

```sql
update imgsys imgsys
set
    scandt = :ScanDate,
    batid = :BatchId,
    updtts = sysdate,
    updrid = :UpdrId
where nvl(idxfl,'N') = 'N'
  and nvl(batid,' ') = case
        when :BatchIdOrig1 is null then ' '
        else :BatchIdOrig2
      end
  and nvl(delcd,' ') = ' '
```

## Operations and processes
- [Imaging system management](../operations/imaging-system-management.md)

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

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