---
title: "SQL-032: InvestigationRepositoryExtensions.GetSubjectName"
summary: Read operation for InvestigationRepositoryExtensions
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data.NHibernate
reference_type: package
---


# SQL-032: InvestigationRepositoryExtensions.GetSubjectName

This statement is a read operation invoked through Inline (Session.CreateSqlQuery). Executed by `InvestigationRepositoryExtensions.GetSubjectName`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-032 |
| **Operation type** | Read |
| **Execution method** | Inline (`Session.CreateSqlQuery`) |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | Text |
| **Business object** | `InvestigationRepositoryExtensions` |
| **Criteria property** | N/A — no IBusinessCriteria |
| **Lifecycle method** | `GetSubjectName` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:investigationId` | Input | long (`SetParameter<long>`) | N/A | Investigation case number (INVESTIGATION_SEQ_NUM) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [INVESTIGATION](../database-tables.md#investigation) | Read | See Sample SQL |
| [SUBJECT](../database-tables.md#subject) | Read | See Sample SQL |
| [PERSON](../database-tables.md#person) | Read | See Sample SQL |
| [COMPANY](../database-tables.md#company) | Read | See Sample SQL |
| [PROVIDER_LOCATION](../database-tables.md#provider_location) | Read | See Sample SQL |
| [POLICY](../database-tables.md#policy) | Read | See Sample SQL |

## Sample SQL

Source: `Data/SAIF.Data.NHibernate/Repositories/Investigations/InvestigationRepositoryExtensions.cs:8`

```sql
 SELECT
nvl(per.NAME,
 nvl(com.company_name,
  nvl(loc.business_name, ''))) as worker_name,
sub.worker_id,
pol.policy_name
 FROM investigation inv
 JOIN subject sub ON inv.subject_seq_num = sub.subject_seq_num
 LEFT OUTER JOIN person per ON per.person_seq_num = sub.person_seq_num
 LEFT OUTER JOIN company com ON com.company_seq_num = sub.company_seq_num
 LEFT OUTER JOIN provider_location loc ON loc.provider_location_seq_num = inv.provider_location_seq_num
 LEFT OUTER JOIN policy pol ON pol.policy_num = inv.policy_num
 WHERE investigation_seq_num = :investigationId
```

## Operations and processes

- [Investigation subject and claim](../operations/investigation-subject-and-claim.md)

## Business rules

- [SDN-BR-050](../business-rules.md#sdn-br-050-investigation-subject-name-resolves-via-person%2C-company-or-provider-location%2C-with-nvl-fallbacks)

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

## Sources
- `Data/SAIF.Data.NHibernate/Repositories/Investigations/InvestigationRepositoryExtensions.cs:8`
