---
title: "SQL-021: clsXDocumentCollection.DeleteSQL"
summary: Deletes all XDOCUMENT rows for a print-control batch by batch primary key.
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Services.Printing.Remote
reference_type: package
---

# SQL-021: clsXDocumentCollection.DeleteSQL

Deletes all `XDOCUMENT` rows belonging to a given `XPRINT_CONTROL_SEQ_NUM`. This SQL is defined in `clsXDocumentCollection.Criteria.DeleteSQL`. However, no `BeforeDelete` override exists anywhere in `clsXDocumentCollection` — execution, if any, depends on undocumented base-class (`clsBusinessCollectionBase`) default wiring that could not be verified from this library's source.** `AfterDelete` is present and does check `RowsAffected <> 1` per [BR-001](../business-rules.md#br-001-row-count-contention-check).

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-021 |
| **Operation type** | Delete |
| **Execution method** | Inline (⚠️ no `BeforeDelete` override exists in `clsXDocumentCollection`; execution wiring is unverifiable from this library's source)** |
| **Database** | Oracle |
| **Schema** | `[unqualified]**` |
| **Command type** | Text |
| **Business object** | `clsXDocumentCollection` |
| **Criteria property** | `DeleteSQL` |
| **Lifecycle method** | `BeforeDelete` (not overridden in this library) |

## Parameters

No `BeforeDelete` override exists to confirm live parameter binding. Bind variable in SQL text:

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:XPrintControlSeqNum` | Input | Decimal* | — | Primary key of the `XPRINT_CONTROL` batch whose documents are to be deleted (type inferred from sibling usages) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [XDOCUMENT](../database-tables.md#xdocument) | DELETE | `XPRINT_CONTROL_SEQ_NUM` |

## Sample SQL

```sql
Delete XDOCUMENT
Where
    XDOCUMENT.XPRINT_CONTROL_SEQ_NUM = :XPrintControlSeqNum
-- ⚠️ No BeforeDelete override exists in clsXDocumentCollection.vb.
-- Execution wiring is unverifiable from this library's source.
```

## Operations and processes
- [Delete documents for a batch](../operations/delete-documents-for-a-batch.md)

## Business rules
- [BR-001: Row-count contention check](../business-rules.md#br-001-row-count-contention-check)

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `Services\SAIF.Services.Printing.Remote\clsXDocumentCollection.vb`
