---
title: "SQL-063: clsPaymentEventCollection retrieve by payment detail"
summary: Retrieves all payment events for a given payment detail sequence number with code and return reason descriptions.
status: draft
owner: SAIF
last_reviewed: 2026-07-24
library: SAIF.Business.Payment.EFT
reference_type: package
---

# SQL-063: clsPaymentEventCollection retrieve by payment detail

Retrieves all payment events for a given payment detail sequence number with code and return reason descriptions.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-063 |
| **Operation type** | Read |
| **Execution method** | Inline SQL |
| **Database** | Oracle* |
| **Schema** | [unqualified]** |
| **Command type** | Text |
| **Business object** | `clsPaymentEventCollection` |
| **Criteria property** | `RetrieveSQL` |
| **Lifecycle method** | `BeforeRetrieve / AfterRetrieve` |


## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| \:PaymentDetailSeqNum\ | Input | Decimal | — | Binds \MyCriteria.PaymentDetailSeqNum\* |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [PAYMENT_EVENT](../database-tables.md#payment_event) | — | — |
| [PAYMENT_EVENT_CODE](../database-tables.md#payment_event_code) | — | — |
| [PAYMENT_RETURN_REASON_CODE](../database-tables.md#payment_return_reason_code) | — | — |

## Sample SQL

```sql
Select PE.BANK_EFF_ENTRY_DATE as BankEffEntryDate,
  PE.BATCH_DATE as BatchDate,
  PE.BATCH_NUM as BatchNum,
  PE.CREATE_DATE as CreateDate,
  PE.CREATE_USER as CreateUser,
  PE.PAYMENT_DETAIL_SEQ_NUM as PaymentDetailSeqNum,
  PE.PAYMENT_EVENT_CODE as PaymentEventCode,
  PE.PAYMENT_EVENT_SEQ_NUM as PaymentEventSeqNum,
  PE.PAYMENT_RETURN_REASON_CODE as PaymentReturnReasonCode,
  PE.TRACE_NUM as TraceNum,
  PEC.CODE_DESCR as PaymentEventCodeDescr,
  PRRC.CODE_DESCR as PaymentReturnReasonCodeDescr
From PAYMENT_EVENT PE
  JOIN PAYMENT_EVENT_CODE PEC ON (PE.PAYMENT_EVENT_CODE = PEC.CODE)
  LEFT OUTER JOIN PAYMENT_RETURN_REASON_CODE PRRC ON (PE.PAYMENT_RETURN_REASON_CODE = PRRC.CODE)
Where PE.PAYMENT_DETAIL_SEQ_NUM = :PaymentDetailSeqNum
```

## Operations and processes
- [Payment detail and allocation](../operations/payment-detail-and-allocation.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.Payment.EFT\clsPaymentEventCollection.vb`
