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

# SQL-384: Delete Location via DeleteDebtor

This statement deletes the `Location` entity identified by its `LOC_SEQ_NUM` key from `LOCATION`, executed via `IUnitOfWork.GetRepository<T>().Delete(...)` from `Services/SAIF.Services/Collections/CollectionsService.cs (L620)` in `CollectionsService.DeleteDebtor`. The SQL below is inferred from this repository call and the NHibernate `LocationMap` mapping — it is not literal SQL present in source.

## Classification

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

## Parameters

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

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [LOCATION](../database-tables.md#location) | DELETE | `LOC_SEQ_NUM` |

## LINQ statement

Source: `Services/SAIF.Services/Collections/CollectionsService.cs:620`

```csharp
// Services/SAIF.Services/Collections/CollectionsService.cs:620
UnitOfWork.GetRepository<LocationDataModel.Location>().Delete(locData);
```

## 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 LOCATION
WHERE LOC_SEQ_NUM = :Id
```

Translation notes:

- Executed only when `debtorData.LocID > 0` (line 617); entity loaded by `GetDebtorLocation(...)` (line 619).
- `LocationDataModel.Location` = `SAIF.Data.Model.Locations.Location`, mapped by `Locations/LocationMap.cs`.

## Operations and processes
- CollectionsService.DeleteDebtor — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Collections/CollectionsService.cs (L620)`
