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

# SQL-199: PolicyQueryProvider.GetPayrollReportForReportId

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

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-199 |
| **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** | `GetPayrollReportForReportId` |

## Parameters

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

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [POLICY_PERIOD_PAYROLL_AUDIT](../database-tables.md#policy_period_payroll_audit) | SELECT | PAYROLL_SEQ_NUM, REPORT_PACKET_SEQ_NUM, POLICY_PERIOD_EFF_DATE, AUDIT_PERIOD_START_DATE, AUDIT_PERIOD_END_DATE, AUDIT_CODE, AUDIT_STATUS_CODE, POLICY_NUM |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Policies/PolicyQueryProvider.cs:62-63`.

```csharp
/// <summary>
/// Get PayrollReport For ReportId
/// </summary>
/// <param name="reportId">Report ID</param>
/// <returns>PolicyPeriodPayrollAudit</returns>
public PolicyPeriodPayrollAudit GetPayrollReportForReportId(long reportId)
{
    return Factory.GetRepository<PolicyPeriodPayrollAudit>().Query()
       .SingleOrDefault(x => x.ReportId == reportId);
}
```

## 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
  PPPA.PAYROLL_SEQ_NUM,
  PPPA.REPORT_PACKET_SEQ_NUM,
  PPPA.POLICY_PERIOD_EFF_DATE,
  PPPA.AUDIT_PERIOD_START_DATE,
  PPPA.AUDIT_PERIOD_END_DATE,
  PPPA.AUDIT_CODE,
  PPPA.AUDIT_STATUS_CODE,
  PPPA.POLICY_NUM
FROM POLICY_PERIOD_PAYROLL_AUDIT PPPA
WHERE PPPA.PAYROLL_SEQ_NUM = :reportId
-- SingleOrDefault: NHibernate expects at most one row
```

Translation notes:
- `ReportId` is the entity Id mapped to `PAYROLL_SEQ_NUM` (`PolicyPeriodPayrollAuditMap.cs:13`), not `REPORT_PACKET_SEQ_NUM` (line 14, `ReportPacketSequenceNumber`).

## Operations and processes

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


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