---
title: "SQL-379: Delete EbillInvoiceError via ProcessInvoiceFile"
summary: Delete operation against EbillInvoiceError via NHibernate ORM.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# SQL-379: Delete EbillInvoiceError via ProcessInvoiceFile

This statement deletes each `EbillInvoiceError` entity for an invoice whose error text does not begin with "Invoice is in balance", via `IUnitOfWork.GetRepository<T>().Delete(entity)` inside a `foreach` loop, invoked from `EBillingService.ProcessInvoiceFile` (`Services/SAIF.Services/Claims/EBilling/EBillingService.cs:1157`). One DELETE is issued per row (`EBILL_INVOICE_ERROR_SEQ_NUM`). The SQL below is inferred from this repository call and the `EbillInvoiceError` NHibernate mapping — it is not literal SQL present in source.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-379 |
| **Operation type** | Delete |
| **Execution method** | ORM (IRepository.Delete) |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `EbillInvoiceError` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `ProcessInvoiceFile` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Id` | Input | long | N/A | Identifier of the EbillInvoiceError being deleted (`EBILL_INVOICE_ERROR_SEQ_NUM`) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [EBILL_INVOICE_ERROR](../database-tables.md#ebill_invoice_error) | DELETE | `EBILL_INVOICE_ERROR_SEQ_NUM` |

## LINQ statement

Source: `Services/SAIF.Services/Claims/EBilling/EBillingService.cs:1157`

```csharp
// Services/SAIF.Services/Claims/EBilling/EBillingService.cs:1151
foreach (var error in oldInvoiceErrors)

// Services/SAIF.Services/Claims/EBilling/EBillingService.cs:1157
_unitOfWork.GetRepository<EbillInvoiceError>().Delete(error);
```

## Sample SQL

> **Inferred SQL:** This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
DELETE FROM EBILL_INVOICE_ERROR
WHERE EBILL_INVOICE_ERROR_SEQ_NUM = :Id
```

Translation notes:

- One DELETE per error returned by `GetInvoiceError(oldInvoice)` whose text does not start with "Invoice is in balance" (line 1153).

## Operations and processes
- EbillingService.ProcessInvoiceFile — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Claims/EBilling/EBillingService.cs (L1157)`
