Fun_GetNum (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 FUNCTIONFunGetNum'._
Narrative
Business context: Numeric-substring extractor — pulls the digits (and .) out of a free-form string while preserving the first run of contiguous digits/decimals, dropping leading zeros until a 1-9 appears. Used in 排产 / 控制面 编号 helpers where a bill number or table name embeds a number that needs to be peeled out.
What it does: Walks str char by char; once a 1-9 is seen, appends subsequent digits and . to the output; non-numeric chars are skipped; returns the accumulated string.
Invocation: Called by Sp_Create_sControlFaceNameTable / *Two / *Three / *Four (control-face table-name builders), Sp_Manufacture_ProductionPlanInfo_detail / *Lock_detail, Sp_productionPlan_BtnEventAutoOrder3–9 (auto-排产 button handlers), and function Fun_GetAddBillNo (bill-number incrementor).