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

# SQL-011: Create CbpServiceCodeStateless via InsertService

This ORM statement performs a create operation on `CbpServiceCodeStateless` via `InsertService`, executed from `Services/SAIF.Services/Claims/ICDCodeService/Icd10CodeService.cs` (L200).

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Code` | Input | `string` | N/A | Composite-key part |
| `:ServiceType` | Input | `string` | N/A | Composite-key part |
| `:UpdateNumber` | Input | `int` | N/A | Version column (`Version()`); NHibernate writes its initial value |
| `:EffectiveDate` | Input | `DateTime` | N/A |  |
| `:ExpirationDate` | Input | `DateTime?` | N/A |  |
| `:IsRp1099Required` | Input | `bool` | N/A | Bound as `'Y'`/`'N'` (`YesNoType`) |
| `:UpdateUser` | Input | `string` | N/A |  |
| `:UpdateDate` | Input | `DateTime` | N/A |  |
| `:IsNurseReviewRequired` | Input | `bool` | N/A | Bound as `'Y'`/`'N'` (`YesNoType`) |
| `:DcbsReportServiceCode` | Input | `string` | N/A |  |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [CBP_SERVICE_CODE](../database-tables.md#cbp_service_code) | INSERT | CODE, BILL_SERVICE_TYPE_CODE, UPDATE_NUM, EFF_DATE, EXP_DATE, RP_1099_REQ_FLAG, UPDATE_USER, UPDATE_DATE, NURSE_REVIEW_REQUIRED_FLAG, DCBS_REPORT_SERVICE_CODE |

## LINQ statement

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

```csharp
// Services/SAIF.Services/Claims/ICDCodeService/Icd10CodeService.cs:200
unitOfWork.GetRepository<CbpServiceCodeStateless>().Add(cbpServiceCode);
```

## 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_SERVICE_CODE (
  CODE,
  BILL_SERVICE_TYPE_CODE,
  UPDATE_NUM,
  EFF_DATE,
  EXP_DATE,
  RP_1099_REQ_FLAG,
  UPDATE_USER,
  UPDATE_DATE,
  NURSE_REVIEW_REQUIRED_FLAG,
  DCBS_REPORT_SERVICE_CODE)
VALUES (
  :Code,
  :ServiceType,
  :UpdateNumber,
  :EffectiveDate,
  :ExpirationDate,
  :IsRp1099Required,
  :UpdateUser,
  :UpdateDate,
  :IsNurseReviewRequired,
  :DcbsReportServiceCode)
```

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.
- `:IsRp1099Required`, `:IsNurseReviewRequired` are bound as `'Y'` / `'N'` (`YesNoType`).

## Operations and processes
- Icd10CodeService.InsertService — 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 (L200)`
