---
title: "SQL-009: Retrieve maximum premium history set id"
summary: Retrieve the latest eligible premium-history set.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy
reference_type: package
---

# SQL-009: Retrieve maximum premium history set id

Retrieve the latest eligible premium-history set.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-009 |
| **Operation type** | Read |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | Text |
| **Business object** | N/A (Application layer) |
| **Criteria property** | N/A |
| **Lifecycle method** | `MaxPremiumHistorySetId` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| `:PolicyNumber` | Input | NUMBER | N/A | Policy number. |
| `:PolicyPeriodEffectiveDate` | Input | DATE | N/A | Policy period effective date. |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [PREM_HIST_SUMMARY](../database-tables.md#prem_hist_summary) | SELECT | `PREM_HIST_SET_ID`, `POLICY_NUM`, `POLICY_PERIOD_EFF_DATE`, `PREM_HIST_TYPE_CODE`

## Sample SQL

```sql
select
  max(prem_hist_set_id)
from prem_hist_summary phs
where phs.policy_num = :PolicyNumber
  and phs.policy_period_eff_date = :PolicyPeriodEffectiveDate
  and phs.prem_hist_type_code in ('1','3')
```

## Operations and processes

- [Retrieve maximum premium history set id](../operations/retrieve-maximum-premium-history-set-id.md)

## Business rules

- See [Business rules](../business-rules.md).

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources

- `Business\SAIF.Business.Policy\PolicyInformation.vb`
