SELECT COUNT(*) INTO p_count FROM ybx_map_cj_fixabst_otherinfo t WHERE t.abst = v_abst AND t.enum_list IS NOT NULL;IF p_count > 0 THEN FOR i IN (SELECT * FROM ybx_map_cj_fixabst_otherinfo t WHERE t.abst = v_abst AND t.enum_list IS NOT NULL) LOOP p_rownum := p_rownum + 1; p_enum_list := REPLACE(REPLACE(i.enum_list, ';', ','), '对照:', ''); SELECT REGEXP_REPLACE(LISTAGG(a.param_code, ' ') WITHIN GROUP (ORDER BY a.param_name), '(\s)+', ' ') INTO p_enum_list FROM ybx_map_cj_fixabst_parammap a WHERE a.param_name = p_enum_list; p_otherinfo := p_otherinfo || p_rownum || '.' || i.mod_fielddisplay || '请填写[' || p_enum_list || ']之一</br>'; END LOOP;END IF;修改以上语法,使其正常运行
时间: 2024-02-17 18:05:32 浏览: 161
tgzamm905.rar_android开发_matlab_
以下是修改后的代码:
```
DECLARE
p_count NUMBER;
p_rownum NUMBER := 0;
p_enum_list VARCHAR2(200);
p_otherinfo VARCHAR2(2000) := '';
BEGIN
SELECT COUNT(*) INTO p_count
FROM ybx_map_cj_fixabst_otherinfo t
WHERE t.abst = v_abst AND t.enum_list IS NOT NULL;
IF p_count > 0 THEN
FOR i IN (SELECT * FROM ybx_map_cj_fixabst_otherinfo t WHERE t.abst = v_abst AND t.enum_list IS NOT NULL) LOOP
p_rownum := p_rownum + 1;
p_enum_list := REPLACE(REPLACE(i.enum_list, ';', ','), '对照:', '');
SELECT REGEXP_REPLACE(LISTAGG(a.param_code, ' ') WITHIN GROUP (ORDER BY a.param_name), '(\s)+', ' ')
INTO p_enum_list
FROM ybx_map_cj_fixabst_parammap a
WHERE a.param_name = p_enum_list;
p_otherinfo := p_otherinfo || p_rownum || '.' || i.mod_fielddisplay || '请填写[' || p_enum_list || ']之一</br>';
END LOOP;
END IF;
END;
```
我对原代码进行了一些调整,主要是将原来的代码放入了一个匿名块中,并且对一些变量进行了声明。同时,也对代码进行了一些排版调整,让其更加易读。
阅读全文