# Phase 10.6.3.1 — Oracle ORA-01461 Bind Guard

## Problem fixed

The automated review write proof could fail on Oracle with:

```text
ORA-01461: can bind a LONG value only for insert into a LONG column
```

The root cause is usually not a missing table. It is an oversized bind value sent by `pdo_oci`, most likely `ACTION_SNAPSHOT` after JSON encoding an action that contains Arabic/multibyte text. Oracle `VARCHAR2(4000)` is often byte-limited, so a value that looks below 4000 characters can exceed 4000 bytes.

## Files changed

- `app/Repositories/ExecutiveActionReviewRepository.php`
- `app/Core/Database.php`

## Technical changes

1. Added byte-safe Oracle text trimming through `oracleText()`.
2. Replaced full action JSON snapshots with a controlled slim action snapshot.
3. Reduced Oracle-bound snapshot payload to a safe byte ceiling.
4. Guarded review notes / old notes / new notes by byte length, not just character count.
5. Made PDO OCI binds explicit as `PDO::PARAM_STR` or `PDO::PARAM_INT`.

## How to validate

After copying this patch over `C:\xampp\htdocs\ddb-new`, rerun:

```text
http://localhost/public/executive-action-review-workflow-qa.php?hospital=njch&write_test=1&token=YOUR_TOKEN
```

Expected result:

```text
WRITE TEST RESULT: saved
[PASS] audit_rows_exist_for_day
[PASS] selected_action_audit_history
```

If the same error still appears, check whether any trigger on `DASH_EXEC_ACTION_REVIEW` or `DASH_EXEC_ACTION_REVIEW_AUDIT` writes to another VARCHAR2 column with a larger payload.
