CLOB数据类型截取SUBSTR_按开始位置偏移量

--DBMS_LOB.substr不加参数表示全部截取,负向截取待定

CREATE OR REPLACE FUNCTION CLOB_SUBSTR(
V_CLOB CLOB,
N_OFFSET NUMBER)
RETURN CLOB
AS
N_BATCH NUMBER;
O_CLOB CLOB;
BEGIN
N_BATCH:=CEIL(DBMS_LOB.GETLENGTH(V_CLOB)/4000);
FOR I IN 1..N_BATCH LOOP
O_CLOB:=O_CLOB||DBMS_LOB.substr(V_CLOB,4000,N_OFFSET+(I-1)*4000);
END LOOP;
RETURN O_CLOB;
END;
/

posted @ 2018-12-20 17:56  virtual_daemon  阅读(2078)  评论(0编辑  收藏  举报