# `GetChineseChar` (function)

> 传入字符串获取其中中文部门


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sOldStr` | `varchar(100)` |

## Body

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

## Narrative

**Business context:** Intended to split a mixed Chinese/Latin string and return only the non-Chinese (ASCII) part — useful for separating product codes/SKUs from their Chinese descriptive names. Header gloss mis-spells the intent: "传入字符串获取其中中文部门" (read as "...部分").

**What it does:** Walks the string one character at a time; classifies each via `REGEXP '[u0391-uFFE5]'` and accumulates into `szwChar` (non-match → "non-Chinese") or `snChar` (match → "Chinese"). Returns `szwChar`.

**Invocation:** Status: appears orphaned. No form-master, gdsmodule, other-routine, or xly-src caller (the matching `xly-src/script/标版/30000101/GetChineseChar.sql` is the definition itself). Bug suspect: the regex character class `[u0391-uFFE5]` is taken as literal `u`/`0`/`3`/`9`/`1`/…/`F`/`E`/`5` rather than the intended Unicode range `Α-￥` — the function effectively classifies every character as non-Chinese and returns the whole input. Same broken regex as `Fun_GetCh` flagged in session 4. Candidate for maintainer audit.
