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

# SQL-387: Delete Note via DeleteNote

This statement deletes the `Note` entity identified by its `LEGAL_COLLECTION_NOTE_SEQ_NUM` key from `LEGAL_COLLECTION_NOTE`, executed via `IUnitOfWork.GetRepository<T>().Delete(...)` from `Services/SAIF.Services/Collections/CollectionsService.cs (L842)` in `CollectionsService.DeleteNote`. The SQL below is inferred from this repository call and the NHibernate `NoteMap` mapping — it is not literal SQL present in source.

## Classification

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

## Parameters

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

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [LEGAL_COLLECTION_NOTE](../database-tables.md#legal_collection_note) | DELETE | `LEGAL_COLLECTION_NOTE_SEQ_NUM` |

## LINQ statement

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

```csharp
// Services/SAIF.Services/Collections/CollectionsService.cs:842
UnitOfWork.GetRepository<DataModel.Note>().Delete(GetdataNote(noteId));
```

## 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 LEGAL_COLLECTION_NOTE
WHERE LEGAL_COLLECTION_NOTE_SEQ_NUM = :Id
```

Translation notes:

- The entity comes from helper `GetdataNote(noteId)`, evaluated inline; its read is a separate statement.

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

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