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


# SQL-021: CollectionsRepository.DebtorLastStatementBalance

This statement is a read operation invoked through StoredProc (named query Collections_GetDebtorLastStatementBalance). Executed by `CollectionsRepository.DebtorLastStatementBalance`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-021 |
| **Operation type** | Read |
| **Execution method** | StoredProc (named query `Collections_GetDebtorLastStatementBalance`) |
| **Database** | Oracle |
| **Schema** | WCIS_DBA* (package owner; unqualified inside package) |
| **Command type** | StoredProcedure |
| **Business object** | `CollectionsRepository` |
| **Criteria property** | N/A — no IBusinessCriteria |
| **Lifecycle method** | `DebtorLastStatementBalance` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:last_statement_date_in` | Input | DATE | N/A | Statement date |
| `:debtor_seq_num_in` | Input | NUMBER (.NET `long`) | N/A | Debtor id |
| `return` | Return | NUMBER → `decimal` | N/A | Statement balance |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [LEGAL_COLLECTION_TRANSACTION](../database-tables.md#legal_collection_transaction) | Read | See Sample SQL |
| [LEGAL_COLLECTION_DEBTOR](../database-tables.md#legal_collection_debtor) | Read | See Sample SQL |
| [LEGAL_COLLECTION_TRAN_CODE](../database-tables.md#legal_collection_tran_code) | Read | See Sample SQL |

## Sample SQL

Source: `Data/SAIF.Data.NHibernate/Mappings/Collections/Collections.hbm.xml:66`

```sql
select pk80010_legal_collections.get_last_statement_balance(
    :last_statement_date_in,
    :debtor_seq_num_in
) as LastStatementBalance from dual
```

## Operations and processes

- [Collections case lookups](../operations/collections-case-lookups.md)

## Business rules

- [PROC-RULE-017](../business-rules.md#proc-rule-017-interest-start-date-and-statement-balance)

> **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
- `Data/SAIF.Data.NHibernate/Repositories/CollectionsRepository.cs:161`
