---
title: "SQL-263: ClaimCodeTableBuilder.ClaimStatus"
summary: Read operation for `ClaimCodeTableBuilder.ClaimStatus`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# SQL-263: ClaimCodeTableBuilder.ClaimStatus

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by `ClaimCodeTableBuilder.ClaimStatus`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-263 |
| **Operation type** | Read |
| **Execution method** | ORM (NHibernate LINQ) |
| **Database** | Oracle* |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `ClaimCodeTableBuilder` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `ClaimStatus` |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [claim_status_code](../database-tables.md#claim_status_code) | SELECT (existence) + INSERT, ×6 (hypothetical) | Code, CODE_DESCR, UPDATE_DATE, UPDATE_USER, UPDATE_NUM |

## LINQ statement

Source: `Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimCodeTableBuilder.cs:59`.

```csharp
// Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimCodeTableBuilder.cs:57-67
public IClaimCodeTableBuilder ClaimStatus()
{
    var repo = _uow.GetRepository<ClaimStatusCode>();
    repo.AddCode("C", "Closed");
    repo.AddCode("D", "Denied");
    repo.AddCode("I", "In Progress");
    // ... 3 further Add/AddCode call(s) through line 67 (elided)
}
```

## Sample SQL

> **Test double — no runtime SQL.** This statement executes against `TestUnitOfWork`/`TestRepository<T>` (in-memory, `List<TEntity>`-backed test doubles in `SAIF.Framework.Core`); no NHibernate session is opened and no SQL is issued at runtime. The SQL below is the hypothetical statement the same expression would produce against a real NHibernate `IUnitOfWork` using the in-repo mappings, shown to document the mapping shape only — **no database table is accessed when this code runs.**

> **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
-- AddCode pattern (SharedExtensions.cs:26-27), issued 6 time(s); first call shown ('C', 'Closed')
SELECT *
FROM (
  SELECT 1
  FROM claim_status_code CSC
  WHERE CSC.Code = :code
    AND CSC.CODE_DESCR = :description)
WHERE ROWNUM <= 1

-- only when the probe returns no row
INSERT INTO claim_status_code (
  Code,
  CODE_DESCR,
  UPDATE_DATE,
  UPDATE_USER,
  UPDATE_NUM)
VALUES (
  :Code,
  :Description,
  :UpdateDate,
  :UpdateUser,
  :UpdateNumber)
```

Translation notes:
- `AddCode(code, description)` (`Data/SAIF.Data/TestRepository/RepositoryExtensions/SharedExtensions.cs:23-28`) runs `repo.Query().Any(x => x.Code == code && x.Description == description)` and, only if false, `repo.Add(new T { Code, Description })`. The pair is issued once per call (6 calls, lines 57-67).
- Columns not set by `AddCode` are written as NULL (or the mapped default) in the INSERT.

## Sources

- `Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimCodeTableBuilder.cs:59`
