#p_jsonstr :json字符串 startkey:开始的key endkey:结束的key
CREATE OR REPLACE FUNCTION PARSEJSONSTR(p_jsonstr varchar2,startkey varchar2,endkey varchar2) RETURN VARCHAR2
IS
rtnVal VARCHAR2(1000);
FindIdxS NUMBER(2);
FindIdxE NUMBER(2);
BEGIN
if endkey='}' then
rtnVal:=substr(p_jsonstr,(instr(p_jsonstr,startkey)+length(startkey) +2)
,(instr(p_jsonstr,endkey,instr(p_jsonstr,startkey))-instr(p_jsonstr,startkey)-length(startkey)-2));
else
rtnVal:=substr(p_jsonstr,(instr(p_jsonstr,startkey)+length(startkey) +2)
,(instr(p_jsonstr,endkey,instr(p_jsonstr,startkey))-instr(p_jsonstr,startkey)-length(startkey)-4));
end if;
RETURN replace(rtnVal,'"','');
END parsejsonstr;
oracle 获取json字符串的属性值
于 2024-08-20 09:35:38 首次发布