PublicDoc/sql/split.sql
2024-09-05 16:28:19 +08:00

17 lines
726 B
MySQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--JK_CRB_ICD10表icd10列按照name和icd10联合组成新行JK_CRB_ICD10_tmp表
~~~sql
insert into JK_CRB_ICD10_tmp
select * from (
SELECT name,
TRIM(SUBSTR(string_to_split,
INSTR(string_to_split, '', 1, LEVEL) + 1,
INSTR(string_to_split, '', 1, LEVEL + 1) - INSTR(string_to_split, '', 1, LEVEL) - 1)
) AS icd10
FROM (SELECT name, '' || icd10 || '' AS string_to_split FROM JK_CRB_ICD10) t,
DUAL
CONNECT BY PRIOR name = name
AND PRIOR DBMS_RANDOM.value IS NOT NULL
AND LEVEL <= LENGTH(t.string_to_split) - LENGTH(REPLACE(t.string_to_split, '', '')) + 1
) ina where ina.icd10 is not null;
~~~