# `F_Gb2Big` (function)


- **Type:** FUNCTION
- **Returns:** `varchar(4000)`
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `str` | `varchar(4000)` |
| 2 | IN | `toBIG` | `int` |

## Body

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

## Narrative

**Business context:** Simplified ↔ Traditional Chinese character conversion utility. xly stores parallel `sChinese` / `sBig5` columns on most master tables so reports rendered for Taiwan/HK customers (or for printing plates targeting Big5 locales) can show the Traditional form. This function is the per-string mapper.

**What it does:** walks each character of `str` and looks it up in the `codetable(gb, big)` table — direction chosen by `toBIG` (1 = GB→Big5, else Big5→GB). Falls back to the original character when no row matches. Pure read; one row lookup per character.

**Invocation:** wrapped by `Fun_Gb2Big_ChineseToBig` and `Sp_Gb2Big_ChineseToBig`, which apply the conversion column-by-column (`sChinese → sBig5`, `sChineseDepart → sBig5Depart`, etc.) on master records during save flows.
