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

# SQL-057: ClaimQueryProvider.GetAttendingPhysician

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

## Classification

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


## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [PROVIDER_LOCATION](../database-tables.md#provider_location) | SELECT | PROVIDER_LOCATION_SEQ_NUM, UPDATE_NUM, BUSINESS_NAME, PAYEE_NAME, PRIMARY_LOCATION_FLAG, BUSINESS_FLAG, PHONE_AREA_CODE, PHONE_NUM, PHONE_NUM_EXT, TOLL_FREE_PHONE_NUM, FAX_NUM, LAST_NAME, FIRST_NAME, MIDDLE_NAME, PROVIDER_TYPE_CODE, PROVIDER_SEQ_NUM |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Claims/ClaimQueryProvider.cs:172-176`, the local function `GetProviderLocationBySequenceNumber(long providerLocationSeqNum)` inside `GetAttendingPhysician`.

```csharp
return Factory
        .GetRepository<Data.Model.Providers.ProviderLocation>()
        .Query()
        .Where(x => x.Id == providerLocationSeqNum)
        .FirstOrDefault();
```

## 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
SELECT *
FROM (
  SELECT
    PL.PROVIDER_LOCATION_SEQ_NUM,
    PL.UPDATE_NUM,
    PL.BUSINESS_NAME,
    PL.PAYEE_NAME,
    PL.PRIMARY_LOCATION_FLAG,
    PL.BUSINESS_FLAG,
    PL.PHONE_AREA_CODE,
    PL.PHONE_NUM,
    PL.PHONE_NUM_EXT,
    PL.TOLL_FREE_PHONE_NUM,
    PL.FAX_NUM,
    PL.LAST_NAME,
    PL.FIRST_NAME,
    PL.MIDDLE_NAME,
    PL.PROVIDER_TYPE_CODE,
    PL.PROVIDER_SEQ_NUM
  FROM PROVIDER_LOCATION PL
  WHERE PL.PROVIDER_LOCATION_SEQ_NUM = :providerLocationSeqNum
)
WHERE ROWNUM <= 1
```

Translation notes:
- `:providerLocationSeqNum` comes from a Guidewire `ClaimContact.ProviderLocSeqNumber`, not from the database.
- The physician and facility contacts come from the Guidewire ClaimCenter API, not NHibernate. This statement runs once or twice per `GetAttendingPhysician` call, depending on whether both a physician and a facility contact are present.
- The filter is on the identifier column, so `FirstOrDefault` returns at most one row; the `ROWNUM` wrapper reflects the Oracle10 dialect.

## Operations and processes

- [Attending physician resolution](../operations/attending-physician-resolution.md)

## Business rules

- [SD-BR-040 Physician without facility is invalid](../business-rules.md#sd-br-040-physician-without-facility-is-invalid)

## Sources
- `Data/SAIF.Data/Queries/Claims/ClaimQueryProvider.cs:172`
