---
title: sp82385_get_next_bill_seqnum stored procedure documentation
summary: Procedure documentation for sp82385_get_next_bill_seqnum.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-28
library: SAIF.Business.Claim.Bill
reference_type: package
---

# sp82385_get_next_bill_seqnum

## Overview

| Field | Value |
| --- | --- |
| **Schema** | WCIS_DBA |
| **Type** | Standalone function |
| **Calling libraries** | `SAIF.Business.Claim.Bill` |
| **Calling classes** | `mdlCBPSupportingData` |

## Purpose

Map intable values to the correct CBP sequence

## Procedures / Methods

### GetNextCBPSeqNum

| Field | Value |
| --- | --- |
| **Returns** | Oracle result or output parameters |
| **Called by** | `mdlCBPSupportingData` |

**Description:** Executes the `GetNextCBPSeqNum` Oracle routine for `SAIF.Business.Claim.Bill`.

## Business Rules

## PR-001: Map intable values to the correct CBP sequence

| Field | Value |
| --- | --- |
| **Statement** | The procedure maps supported `intable` values to the correct CBP sequence |
| **Trigger** | `sp82385_get_next_bill_seqnum` receives `CBP_AUDIT_ERROR`, `CBP_BILL`, `CBP_BILL_STATUS`, `CBP_EOB_NOTE`, or `CBP_NOTE` |
| **Enforcement** | `sp82385_get_next_bill_seqnum` selects the matching Oracle sequence and returns the next value |
| **Outcome** | Callers receive a table-specific sequence value for new CBP records |
| **Confidence** | Verified |
| **Source** | `Business\SAIF.Business.Claim.Bill\AuditSupport\mdlCBPSupportingData.vb` (`GetNextCBPSeqNum` calls `sp82385_get_next_bill_seqnum`) |

---

## Operations

| Operation | Description | Trigger |
| --- | --- | --- |
| Generate CBP sequence number | Allocates a new identifier for CBP bill-side records | mdlCBPSupportingData.GetNextCBPSeqNum |

## Source Code

```sql
FUNCTION sp82385_get_next_bill_seqnum
/****************************************************************
*Procedure Title  : Get Next Bill Sequence Number
*Name             : sp82385_get_next_bill_seq_num
*Called by        : .NET Console App OCR Bill Import
*Programmer       : Wayne Sniffen
*****************************************************************
*Description:    Gets a new sequence number for a CBP Bill
*                table depending on what table is passed.  Tthis
*                function makes a call to a DB2 stored procedure
*                cbu001_cbp_key_gen
*
* Maintenance Log:
*   Name            Date      Description
* Bricot        08/10/2011  Changes sequence for CBP_Bill_seq and EOB_Note_Seq
* Bricot         08/02/2011  Change sequence for CBP_Audit_Error
*
******************************************************************/
  (intable IN VARCHAR2)
      RETURN VARCHAR2
   AS
      v_new_billid   VARCHAR2 (9);

   BEGIN
      CASE intable
         WHEN 'CBP_AUDIT_ERROR'
         THEN
         SELECT to_char(CBP_AUDIT_MESSAGE_SEQ.nextval) into v_new_billid from dual;
            return(v_new_billid);

         WHEN 'CBP_BILL'
         THEN
            SELECT to_char(CBP_BILL_SEQ.nextval) into v_new_billid from dual;
            return(v_new_billid);

         WHEN 'CBP_BILL_STATUS'
         THEN
            SELECT to_char(BILL_STATUS_SEQ.nextval) into v_new_billid from dual;
            return(v_new_billid);

         WHEN 'CBP_EOB_NOTE'
         THEN
            SELECT to_char(CBP_EOB_NOTE_SEQ.nextval) into v_new_billid from dual;
            return(v_new_billid);

         WHEN 'CBP_NOTE'
         THEN
            SELECT to_char(CBP_NOTE_SEQ.nextval) into v_new_billid from dual;
            return(v_new_billid);

      END CASE;

      RETURN v_new_billid;
   END sp82385_get_next_bill_seqnum;
```

## Related documentation
- [Procedure catalog](index.md)
- [Business rules](../business-rules.md)
- [Operations and processes](../operations-processes.md)
- [SQL catalog](../sql/index.md)

## Sources
- `Business\SAIF.Business.Claim.Bill\AuditSupport\mdlCBPSupportingData.vb`
