# `sp_get_sOppositeColor_data` (procedure)


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `p_sOppositeColor` | `longtext` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | OUT | `sCode` | `int` |
| 5 | OUT | `sReturn` | `longtext` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `sp_get_sOppositeColor_data`'`._

## Narrative

**Business context:** Companion to `sp_get_sOppositeColor` (印刷 / 工艺 — "opposite-side color" helper that tracks which color drops on which side of a sheet in multi-color printing). This procedure deserialises the JSON-encoded `sOppositeColor` blob stored on production-report rows into a tabular form for downstream consumers; `sp_get_sOppositeColor` calls it.

**What it does:** Sets `sCode=1`. If `p_sOppositeColor` isn't valid JSON, leaves `top:`. Otherwise converts the blob to a JSON value and runs `SELECT sName, dColor, sId FROM JSON_TABLE(p_sOppositeColor, '$[*]' COLUMNS (sId VARCHAR(100) PATH '$.sId', sName VARCHAR(100) PATH '$.sName', dColor decimal(18,6) PATH '$.dColor')) AS A` — returning one row per JSON element with the color id, swatch name, and color-quantity.

**Invocation:** Called by `sp_get_sOppositeColor` (the proc that the wiki's narrative sample already covers — see `sp_get_sOppositeColor.md`). No other channel references this proc: no `gdsmodule` hook, no `gdsconfigformmaster` reference, no xly-src grep hit. So its sole live caller is the sibling proc, which in turn is itself orphan-by-grep — treat both as a paired helper bundle.
