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

# SQL-007: Create CbpAuthorizationSurgery via AddSurgeryDate

This ORM statement performs a create operation on `CbpAuthorizationSurgery` via `AddSurgeryDate`, executed from `Services/SAIF.Services/Claims/Bills/AuthorizationService.cs` (L114).

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:ClaimId` | Input | `long` | N/A | Composite-key part |
| `:SurgeryDate` | Input | `DateTime` | N/A | Composite-key part |
| `:UpdateNumber` | Input | `int` | N/A | Version column (`Version()`); NHibernate writes its initial value |
| `:UpdateDate` | Input | `DateTime` | N/A |  |
| `:UpdateUser` | Input | `string` | N/A |  |

## Tables

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

## LINQ statement

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

```csharp
// Services/SAIF.Services/Claims/Bills/AuthorizationService.cs:114
unitOfWork.GetRepository<CbpAuthorizationSurgery>().Add(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
INSERT INTO CBP_AUTHORIZATION_SURGERY (
  CLAIM_ID,
  SURGERY_DATE,
  UPDATE_NUM,
  UPDATE_DATE,
  UPDATE_USER)
VALUES (
  :ClaimId,
  :SurgeryDate,
  :UpdateNumber,
  :UpdateDate,
  :UpdateUser)
```

Translation notes:
- Composite identifier (`CompositeId()`) with no generator: every key part is supplied by the caller. A stateful `SaveOrUpdate` on a composite-key entity may first issue a `SELECT` by the key columns to decide between INSERT and UPDATE unless the version unsaved-value identifies the instance as transient.
- `UPDATE_NUM` is the optimistic-concurrency version column (`Version(x => x.UpdateNumber)`); NHibernate sets its initial value on INSERT.

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

## Business rules
- [SVC-BR-BIL-141 No duplicate surgery date per claim](../business-rules.md#svc-br-bil-141-no-duplicate-surgery-date-per-claim)

> **Note:** Statements marked with `**` could not be confirmed; treat as unknown until verified.

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