Fun_deleteManyChar.md 1.52 KB

Fun_deleteManyChar (function)

根据in_splict切割字符串,去除重复元素

  • Type: FUNCTION
  • Returns: varchar(600)
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN in_str varchar(600)
2 IN in_splict varchar(600)

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTIONFundeleteManyChar'._

Narrative

Business context: Generic string-dedup helper used by Sp_Bill_Used (bill / document linkage tracking — checks how many parents an id list has already been consumed by). Header comment is 根据in_splict切割字符串,去除重复元素 ("split the string by in_splict, remove duplicates"). When the caller has accumulated a comma-joined id list with possible repeats, it pipes it through this function before counting usage.

What it does: strips all spaces, collapses doubled separators, appends one trailing separator so the loop has a stop token, then walks the string token-by-token (SUBSTR + INSTR) and concatenates each token onto v_result only if INSTR(v_result, token) = 0. Returns the result with the trailing separator trimmed off. Pure string mechanics — no table reads or writes.

Invocation: called from Sp_Bill_Used (and its customer-override variants under script/客户/千彩 and script/客户/统兴) to dedup id lists before counting parent-document usage. No form-master, gdsmodule-hook, or Java caller.