为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:dm8
【操作系统】:win
【CPU】:
【问题描述】*首先驱动可以确定是一致的
1、用dm的工具调试存储过程正常有返回,不报错。
2、用程序调用时报存储过程执行时出错:dm.jdbc.driver.DMException: JSON值语法错误 {call query_myworkflow_one(?,?,?,?,?,?,?,?)}
dm.jdbc.driver.DMException: JSON值语法错误
json 相关代码如下
condi_field_obj varchar2(5000); --条件对象
condi_field_key varchar2(5000);
condi_field varchar2(5000); --条件字段
condi_val varchar2(5000); --条件值
condi_str varchar2(5000);
sort_field varchar2(500);
sort_val varchar2(500);
sort_str varchar2(500);
sel_type varchar2(200); --查询类型 0精确 1模糊
v_ctval1 varchar2(100);--拆分字符串得到第一个时间值
v_ctval2 varchar2(100);--拆分字符串得到第二个时间值
v_num number;
issql VARCHAR2(1500);
issql2 VARCHAR2(1500);
insdata VARCHAR(5000);--插入数据语句
insdata1 VARCHAR(5000);--插入数据语句
drptable VARCHAR2(100):='drop view MY_WORKFLOW ';--删除表
v_exists NUMBER(10);--判断视图是否存在
sort_Constrainval varchar2(100);--排序约束
BEGIN
--20211110zrpadd增加判断是否存在的删除
SELECT COUNT(*) INTO v_exists FROM User_Views WHERE view_name='MY_WORKFLOW';
IF(v_exists>0)THEN
EXECUTE IMMEDIATE drptable;--删除临时表
END IF;
if (tiaojian is not null or tiaojian <> '') then
--遍历数组元素
declare cursor mycur is
select value from jsonb_array_elements(tiaojian);
begin
open mycur;
loop
fetch mycur into condi_field_obj;
exit when mycur%notfound;
declare cursor mycur1 is
----遍历对象元素
SELECT JSON_OBJECT_KEYS FROM JSON_OBJECT_KEYS(condi_field_obj);
begin
open mycur1;
loop
fetch mycur1 into condi_field;
exit when mycur1%notfound;
if (condi_field <>'seltype') then --获取对象属性字段内容
select json_value(condi_field_obj,'$.'||condi_field||'') as aa into condi_val;
select json_value(condi_field_obj,'$.seltype') as bb into sel_type;
if(condi_field='COMPLETED_DATE')THEN
select SUBSTR(condi_val,1,INSTR(condi_val,'+', 1, 1)-2),SUBSTR(condi_val,INSTR(condi_val,'+', 1, 1)+2,length(condi_val))
into v_ctval1,v_ctval2 from dual;
condi_str:=condi_str||' and to_char(COMPLETED_DATE,''yyyy-mm-dd hh24:mi:ss'') >= '''||v_ctval1 ||''' and to_char(COMPLETED_DATE,''yyyy-mm-dd hh24:mi:ss'') <= '''||v_ctval2||'''';
--zrpadd转换条件
ELSIF(condi_field='STARTED_DATE')then
select SUBSTR(condi_val,1,INSTR(condi_val,'+', 1, 1)-2),SUBSTR(condi_val,INSTR(condi_val,'+', 1, 1)+2,length(condi_val))
into v_ctval1,v_ctval2 from dual;
condi_str:=condi_str||' and to_char(STARTED_DATE,''yyyy-mm-dd hh24:mi:ss'') >= '''||v_ctval1 ||''' and to_char(STARTED_DATE,''yyyy-mm-dd hh24:mi:ss'') <= '''||v_ctval2||'''';
else
---判断是否属于多选
select INSTR(condi_val,'[', 1) into v_num from dual;
--多选处理
if(v_num>=1)then
----复选框处理
if(sel_type=13)then
select replace(replace(replace(condi_val,'"',''),'[',''''),']','''') into condi_val from dual;
condi_str:=condi_str||' and '||condi_field||' = '||condi_val;
else
----普通多选
select replace(replace(replace(condi_val,'[','('),']',')'),'"','''') into condi_val from dual;
condi_str:=condi_str||' and '||condi_field||' in '||condi_val;
end if;
---输入属性
else
if(sel_type in (2,8))then
condi_str:=condi_str||' and '||condi_field||'='''||condi_val||'''';
ELSE
condi_str:=condi_str||' and '||condi_field||' like ''%'||condi_val||'%''';
end if;
end if;
end if;
end if;
end loop;
close mycur1;
end;
end loop;
close mycur;
end;
end if;
修改成oracle 兼容模式