Fun_GetCh (function)
获取字符串中数字
- Type: FUNCTION
-
Returns:
varchar(100) - Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | str |
varchar(100) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTIONFunGetCh'._
Narrative
Business context: String filter — header says 获取字符串中数字 ("extract digits from a string") but the body actually returns characters that do not match the regex [u0391-uFFE5] (the literal u-prefixed pattern is invalid; MySQL falls back to matching only the letter u and the ASCII range 0391-FFE5, so the filter is effectively a no-op character whitelist). After stripping - and +, it accumulates the remaining characters.
What it does: strips - and +, then walks the string one char at a time appending each character whose REGEXP test against '[u0391-uFFE5]' is not 1. Effective behavior: returns the input with -/+ removed. Header comment is inconsistent with the body.
Invocation: called from Sp_Create_sControlFaceNameTable and Sp_Create_sControlFaceNameTableFive (control/process-name table builders). With the regex broken, the filter step is a no-op — flag as bug suspect for maintainer audit.