# Business Logic — JBSbatKKSkaWrkCnclProc.executeKK_T_OP_SVC_KEI_KK_SELECT_094() [10 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKSkaWrkCnclProc` |
| Layer | Batch (Package: `eo.business.service` — batch processing service layer) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKSkaWrkCnclProc.executeKK_T_OP_SVC_KEI_KK_SELECT_094()

This method performs a **read (R) data retrieval** from the Option Service Contract table (`KK_T_OP_SVC_KEI`) using SQL key `KK_SELECT_094`. It is a private batch helper method that serves as a thin database access delegation layer — accepting a parameter array of bind variables, constructing a `JBSbatCommonDBInterface` list, populating the bind variables from the array, and dispatching the query through the `JBSbatSQLAccess` infrastructure. The method is invoked during batch processing workflows such as service contract cancellation processing (`JBSbatKKSkaWrkCnclProc`) and old-contract change interface addition (`JBSbatKKCrsChgOldKeiIfAdd`), where it is called to look up service contract line item details by the **Option Service Contract Number** and the **Reservation Applicable Date (Year-Month-Day)**. Its role in the larger system is as a standardized SQL access delegate following the batch SQL template pattern — each SQL key (e.g., `KK_SELECT_094`) corresponds to a pre-defined SQL statement registered in the batch SQL definition registry, and this method simply routes the call.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_OP_SVC_KEI_KK_SELECT_094(params)"])
    STEP1(["1. Generate bind variable list (バイン変数のリストを生成します)"])
    SET0(["paramList = new JBSbatCommonDBInterface()"])
    SET1(["paramList.setValue(param[0].toString())"])
    SET2(["paramList.setValue(param[1].toString())"])
    STEP2(["2. Execute DB access (DBアクセスを実行します)"])
    DBCALL(["db_KK_T_OP_SVC_KEI_094.selectBySqlDefine(paramList, KK_SELECT_094)"])
    END_NODE(["Return / Next"])

    START --> STEP1
    STEP1 --> SET0
    SET0 --> SET1
    SET1 --> SET2
    SET2 --> STEP2
    STEP2 --> DBCALL
    DBCALL --> END_NODE
```

**Constant Resolution:**
- `KK_T_OP_SVC_KEI_KK_SELECT_094 = "KK_SELECT_094"` — SQL definition key for the Option Service Contract selection query. This constant is defined as `private static final String` at line 64 of `JBSbatKKSkaWrkCnclProc.java`.
- `D_TBL_NAME_KK_T_OP_SVC_KEI = "KK_T_OP_SVC_KEI"` — The database table name used when initializing the `JBSbatSQLAccess` instance `db_KK_T_OP_SVC_KEI_094` (resolved from `JBSbatKKEoTelPackUtil.java` / `JBSbatKKCourseChgChuJdg.java`).

The method has **no conditional branches** — it executes a linear two-step sequence: (1) construct the bind variable list, and (2) execute the SQL select.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `Object[]` | Bind variable value array for the SQL query. Must contain exactly 2 elements: `param[0]` is the **Option Service Contract Number** (`OP_SVC_KEI_NO`) — the unique identifier for a service contract line item; `param[1]` is the **Reservation Applicable Date (Year-Month-Day)** (`opeDate`) — the business date used to filter reservations. Both values are converted to strings via `toString()` before being bound to the SQL query. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_OP_SVC_KEI_094` | `JBSbatSQLAccess` | SQL access delegate initialized with the `KK_T_OP_SVC_KEI` table. Created in the batch's `execute()` method via `new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_OP_SVC_KEI)`. |
| `KK_T_OP_SVC_KEI_KK_SELECT_094` | `String` (static final) | SQL definition key constant = `"KK_SELECT_094"`. |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_KK_T_OP_SVC_KEI_094.selectBySqlDefine` | — | `KK_T_OP_SVC_KEI` | Executes a parameterized SQL SELECT on the Option Service Contract table using the pre-registered SQL definition key `KK_SELECT_094`. Returns a `JBSbatCommonDBInterface` result set via `selectNext()` at the caller level. |
| - | `JBSbatCommonDBInterface.setValue` | JDK | — | Adds bind variable values to the parameter list object. Called twice: once for the Option Service Contract Number, once for the Reservation Applicable Date. |
| - | `Object.toString()` | JDK | — | Converts each `param[]` element to a String for binding to the SQL query. |

**CRUD Classification:**
- **R** (Read): `selectBySqlDefine` — This is a read-only SQL SELECT operation. The result is consumed by the caller (e.g., `JBSbatKKSkaWrkCnclProc.execute()`) which calls `db.selectNext()` to retrieve the row(s).

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `selectBySqlDefine` [`KK_T_OP_SVC_KEI`]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKSkaWrkCnclProc.execute()` | `JBSbatKKSkaWrkCnclProc.execute()` → `executeKK_T_OP_SVC_KEI_KK_SELECT_094(whereParam)` | `selectBySqlDefine [R] KK_T_OP_SVC_KEI` |
| 2 | Batch: `JBSbatKKDelRun.execute()` | `JBSbatKKDelRun.execute()` → `executeKK_T_OP_SVC_KEI_KK_SELECT_094(param)` | `selectBySqlDefine [R] KK_T_OP_SVC_KEI` |
| 3 | Batch: `JBSbatKKCrsChgOldKeiIfAdd.execute()` | `JBSbatKKCrsChgOldKeiIfAdd.execute()` → `executeKK_T_OP_SVC_KEI_KK_SELECT_094(whereOpSvcKeiParam)` | `selectBySqlDefine [R] KK_T_OP_SVC_KEI` |

**Notes:**
- `JBSbatKKSkaWrkCnclProc.execute()` — The primary batch entry point for service contract cancellation processing. It calls this method to look up Option Service Contract details by contract number and operation date during the cancellation workflow.
- `JBSbatKKDelRun.execute()` — A batch job that handles deletion operations. Calls the same method with bind variables for contract number and date.
- `JBSbatKKCrsChgOldKeiIfAdd.execute()` — A batch job for creating change interface records for old contracts. Calls this method at multiple points (lines 5854 and 9185) to check for existing Option Service Contract records.

## 6. Per-Branch Detail Blocks

### Block 1 — METHOD ENTRY `(param: Object[])` (L434–L443)

> Business description: This method generates a bind variable list from the incoming parameter array and executes a parameterized SQL SELECT on the Option Service Contract table (`KK_T_OP_SVC_KEI`). It has no conditional branches — it is a linear pass-through from raw parameters to structured SQL bind variables.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `paramList = new JBSbatCommonDBInterface()` // バイン変数のリストを生成します (Generate bind variable list) | Create a new `JBSbatCommonDBInterface` object to hold the SQL bind variables. This object serves as a parameter list for the SQL access call. |
| 2 | EXEC | `paramList.setValue(param[0].toString())` // Bind: Option Service Contract Number | Convert the first element of the `param` array (Option Service Contract Number — `OP_SVC_KEI_NO`) to a String and add it as the first bind variable. |
| 3 | EXEC | `paramList.setValue(param[1].toString())` // Bind: Reservation Applicable Date | Convert the second element of the `param` array (Reservation Applicable Date — year-month-day format) to a String and add it as the second bind variable. |
| 4 | CALL | `db_KK_T_OP_SVC_KEI_094.selectBySqlDefine(paramList, KK_SELECT_094)` // DBアクセスを実行します (Execute DB access) | Execute a SQL SELECT on the Option Service Contract table using the pre-registered SQL definition key `KK_SELECT_094`. The `paramList` provides the two bind variables. The caller retrieves results via `db.selectNext()`. |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_OP_SVC_KEI` | DB Table | Option Service Contract Table — stores service contract line item records including contract numbers, service types, and associated dates. The `KK_` prefix indicates a K-OPT (Korea Optel) specific business table. |
| `KK_SELECT_094` | SQL Key | Pre-registered SQL statement definition key for selecting Option Service Contract records by contract number and operation date. The "094" suffix is an internal sequence number in the SQL definition registry. |
| `OP_SVC_KEI_NO` | Field | Option Service Contract Number — the unique identifier for a service contract line item (e.g., `OP_SVC_KEI_UCWK_NO` is the internal work tracking number for the service contract detail). |
| `opeDate` | Field | Reservation Applicable Date (Year-Month-Day) — the business date used to filter reservations. Typically passed as a String in `yyyyMMdd` format (e.g., `20230628`). |
| `JBSbatCommonDBInterface` | Class | Common database interface class used to build parameter lists for batch SQL access. Provides `setValue()` to add bind variables in order. |
| `JBSbatSQLAccess` | Class | SQL access delegate class for executing parameterized SQL statements in the batch framework. Initialized with a table name and provides `selectBySqlDefine()`, `selectNext()`, and `close()` methods. |
| `param[0]` | Field | First bind variable — Option Service Contract Number (`OP_SVC_KEI_NO`). |
| `param[1]` | Field | Second bind variable — Reservation Applicable Date (Year-Month-Day, the `opeDate` field). |
| `JBSbatKKSkaWrkCnclProc` | Class | Service Contract Cancellation Processing Batch — the batch job class that orchestrates service contract cancellation workflows. This method is one of many private helper methods within it. |
| `db_KK_T_OP_SVC_KEI_094` | Instance Field | SQL access instance for the Option Service Contract table, initialized with table name `KK_T_OP_SVC_KEI`. The `_094` suffix distinguishes it from other SQL access instances that may also target the same table. |
| `KK` | Prefix | K-OPT — a telecommunications service platform/product line in the Japanese/Korean market. Appears in class names, table names, and SQL keys throughout the codebase. |
