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

# SQL-365: Delete CbpAuthorizationSurgery via DeleteSurgeryDate

This statement deletes the `CbpAuthorizationSurgery` entity identified by its composite key (`CLAIM_ID`, `SURGERY_DATE`) via `IUnitOfWork.GetRepository<T>().Delete(entity)`, invoked from `AuthorizationService.DeleteSurgeryDate` (`Services/SAIF.Services/Claims/Bills/AuthorizationService.cs:127`). Because the map declares a `Version` column, the deletion also carries an optimistic-concurrency check on `UPDATE_NUM`. The SQL below is inferred from this repository call and the `CbpAuthorizationSurgery` NHibernate mapping — it is not literal SQL present in source.

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:ClaimId` | Input | long | N/A | Identifier of the CbpAuthorizationSurgery being deleted (`CLAIM_ID`) |
| `:SurgeryDate` | Input | DateTime | N/A | Identifier of the CbpAuthorizationSurgery being deleted (`SURGERY_DATE`) |
| `:oldVersion` | Input | int | N/A | Current `UPDATE_NUM` value (optimistic-concurrency check) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [CBP_AUTHORIZATION_SURGERY](../database-tables.md#cbp_authorization_surgery) | DELETE | `CLAIM_ID`, `SURGERY_DATE`, `UPDATE_NUM` |

## LINQ statement

Source: `Services/SAIF.Services/Claims/Bills/AuthorizationService.cs:127`

```csharp
// Services/SAIF.Services/Claims/Bills/AuthorizationService.cs:127
unitOfWork.GetRepository<CbpAuthorizationSurgery>().Delete(date);
```

## 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 CBP_AUTHORIZATION_SURGERY
WHERE CLAIM_ID = :ClaimId
  AND SURGERY_DATE = :SurgeryDate
  AND UPDATE_NUM = :oldVersion
```

Translation notes:

- `Version(x => x.UpdateNumber).Column("UPDATE_NUM")` adds the old-version predicate to the DELETE.
- Composite key (`CLAIM_ID`, `SURGERY_DATE`); entity loaded at line 123 (separate read).

## Operations and processes
- AuthorizationService.DeleteSurgeryDate — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Claims/Bills/AuthorizationService.cs (L127)`
