我正在尝试通过使用以下功能将blob数据转换为clob,它工作正常。但是将其转换为CLOB之后,我想根据无法使用的分隔符来分割记录。
div
下面是示例CLOB数据,它将定界符显示为“?” 查询
CREATE OR REPLACE FUNCTION blob_to_clob (blob_in IN BLOB)
RETURN CLOB
AS
c_buffer CONSTANT PLS_INTEGER := 32767;
v_clob CLOB;
v_varchar VARCHAR2(32767);
v_start PLS_INTEGER := 1;
BEGIN
DBMS_LOB.CREATETEMPORARY(v_clob, TRUE);
FOR i IN 1 .. CEIL( DBMS_LOB.GETLENGTH(blob_in) / c_buffer ) LOOP
v_varchar := UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(blob_in, c_buffer, v_start));
DBMS_LOB.WRITEAPPEND(v_clob, LENGTH(v_varchar), v_varchar);
v_start := v_start + c_buffer;
END LOOP;
RETURN v_clob;
END blob_to_clob;
/
输出 181390444268592.000001?181403657657150.120001?181576596572996.090001?181586235750048.110001?182271815726104.190001?182274070050018.050001?182294213659098.050001
但是当我尝试在下面的查询中运行以仅获取第一个值时,它无法根据'?'对其进行拆分
从FMKC_STMT_PRINTED中选择REGEXP_SUBSTR(UTL_RAW.CAST_TO_VARCHAR2(XMLRECORD),'[^?“] +',1,1),其中recid ='0225307596-20180923';
我什至尝试了以下功能来拆分CLOB数据
select UTL_RAW.CAST_TO_VARCHAR2(XMLRECORD) from FMKC_STMT_PRINTED where recid = '0225307596-20180923';
但结果仍然相同,显示我为“?”定界符,但在查询中使用
SELECT split_clob(blob_to_clob(XMLRECORD),'?')AS RECID FROM KES_STMT_PRINT_TEST t;
它不起作用
输出 181390444268592.000001?181403657657150.120001?181576596572996.090001
预期输出为 181390444268592.000001 181403657657150.120001 181576596572996.090001