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

# SQL-196: PolicyQueryProvider.GetPolicyTeamFunction

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

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `policyNumber` | Input | long | N/A | Method argument of `PolicyQueryProvider.GetPolicyTeamFunction` bound into the ORM expression; NHibernate generates the bind variable at runtime |
| `teamFunctionCode` | Input | string | N/A | Method argument of `PolicyQueryProvider.GetPolicyTeamFunction` bound into the ORM expression; NHibernate generates the bind variable at runtime |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [POLICY_TEAM_FUNCTION](../database-tables.md#policy_team_function) | SELECT | POLICY_NUM, TEAM_FUNCTION_CODE, UPDATE_DATE, UPDATE_USER, USER_NAME |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Policies/PolicyQueryProvider.cs:37-39`.

```csharp
public PolicyTeamFunction GetPolicyTeamFunction(long policyNumber, string teamFunctionCode)
{
    return Factory.GetRepository<PolicyTeamFunction>().Query()
        .SingleOrDefault(t => t.PolicyNumber == policyNumber 
        && t.TeamFunctionCode == teamFunctionCode);
}
```

## 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
  PTF.POLICY_NUM,
  PTF.TEAM_FUNCTION_CODE,
  PTF.UPDATE_DATE,
  PTF.UPDATE_USER,
  PTF.USER_NAME
FROM POLICY_TEAM_FUNCTION PTF
WHERE PTF.POLICY_NUM = :policyNumber
  AND PTF.TEAM_FUNCTION_CODE = :teamFunctionCode
-- SingleOrDefault: NHibernate expects at most one row
```

Translation notes:
- Composite key `POLICY_NUM` + `TEAM_FUNCTION_CODE` (`PolicyTeamFunctionMap.cs:12-14`). `USER_NAME` is the FK of the lazy `WcisEmployee` reference, which is not joined.

## Operations and processes

- [Other query providers](../operations/other-query-providers.md)


## Sources
- `Data/SAIF.Data/Queries/Policies/PolicyQueryProvider.cs:37`
