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

# SQL-009: Create CbpDiagnosis via InsertDiagnosis

This ORM statement performs a create operation on `CbpDiagnosis` via `InsertDiagnosis`, executed from `Services/SAIF.Services/Claims/ICDCodeService/Icd10CodeService.cs` (L234).

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:DiagnosisCode` | Input | `string` | N/A | Identifier supplied by the caller |
| `:UpdateNumber` | Input | `int` | N/A | Version column (`Version()`); NHibernate writes its initial value |
| `:IcdVersionCode` | Input | `string` | N/A |  |
| `:DiagnosisDescription` | Input | `string` | N/A |  |
| `:DiagnosisShortDescription` | Input | `string` | N/A |  |
| `:DiagnosisCategoryCode` | Input | `string` | N/A |  |
| `:IsValidMedicareReport` | Input | `bool` | N/A | Bound as `'Y'`/`'N'` (`YesNoType`) |
| `:EffectiveDate` | Input | `DateTime` | N/A |  |
| `:ExpirationDate` | Input | `DateTime?` | N/A |  |
| `:UpdateUser` | Input | `string` | N/A |  |
| `:UpdateDate` | Input | `DateTime` | N/A |  |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [CBP_DIAGNOSIS](../database-tables.md#cbp_diagnosis) | INSERT | DIAGNOSIS_CODE, UPDATE_NUM, ICD_VERSION_CODE, DIAGNOSIS_DESCR, DIAGNOSIS_SHORT_DESCR, DIAGNOSIS_CATEGORY_CODE, VALID_MEDICARE_REPORT_FLAG, EFF_DATE, EXP_DATE, UPDATE_USER, UPDATE_DATE |

## LINQ statement

Source: `Services/SAIF.Services/Claims/ICDCodeService/Icd10CodeService.cs:234`.

```csharp
// Services/SAIF.Services/Claims/ICDCodeService/Icd10CodeService.cs:234
unitOfWork.GetRepository<CbpDiagnosis>().Add(cbpDiagnosis);
```

## 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_DIAGNOSIS (
  DIAGNOSIS_CODE,
  UPDATE_NUM,
  ICD_VERSION_CODE,
  DIAGNOSIS_DESCR,
  DIAGNOSIS_SHORT_DESCR,
  DIAGNOSIS_CATEGORY_CODE,
  VALID_MEDICARE_REPORT_FLAG,
  EFF_DATE,
  EXP_DATE,
  UPDATE_USER,
  UPDATE_DATE)
VALUES (
  :DiagnosisCode,
  :UpdateNumber,
  :IcdVersionCode,
  :DiagnosisDescription,
  :DiagnosisShortDescription,
  :DiagnosisCategoryCode,
  :IsValidMedicareReport,
  :EffectiveDate,
  :ExpirationDate,
  :UpdateUser,
  :UpdateDate)
```

Translation notes:
- No generator is declared on `Id(DiagnosisCode)` (type `string`); FluentNHibernate defaults a non-integral identifier to `assigned`, so `:DiagnosisCode` is supplied by the caller. A stateful `SaveOrUpdate` may first issue a `SELECT` by `DIAGNOSIS_CODE` to decide between INSERT and UPDATE.
- `UPDATE_NUM` is the optimistic-concurrency version column (`Version(x => x.UpdateNumber)`); NHibernate sets its initial value on INSERT.
- `:IsValidMedicareReport` are bound as `'Y'` / `'N'` (`YesNoType`).

## Operations and processes
- Icd10CodeService.InsertDiagnosis — see [Operations and processes](../operations-processes.md)

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

## Sources
- `Services/SAIF.Services/Claims/ICDCodeService/Icd10CodeService.cs (L234)`
