使用function:create or replace function getcontent(v_id IN number,pos in number) return varchar2
IS
lobloc CLOB;
buffer VARCHAR2(32767);
amount NUMBER := 2000;
offset NUMBER := 1;
BEGIN
--Initialize buffer with data to be inserted
SELECT content INTO lobloc -- get LOB handle
FROM CONTENT_TABLE
WHERE id = v_id;
offset:=offset+(pos-1)*2000;
dbms_lob.read(lobloc,amount,offset,buffer);
--read 2000 varchar2 from the buffer
return buffer;
EXCEPTION
WHEN NO_DATA_FOUND THEN
return buffer;
END;
IS
lobloc CLOB;
buffer VARCHAR2(32767);
amount NUMBER := 2000;
offset NUMBER := 1;
BEGIN
--Initialize buffer with data to be inserted
SELECT content INTO lobloc -- get LOB handle
FROM CONTENT_TABLE
WHERE id = v_id;
offset:=offset+(pos-1)*2000;
dbms_lob.read(lobloc,amount,offset,buffer);
--read 2000 varchar2 from the buffer
return buffer;
EXCEPTION
WHEN NO_DATA_FOUND THEN
return buffer;
END;
谢谢!
oracle.sql.CLOB clob =oracle.sql.CLOB.createTemporary(con, false,oracle.sql.CLOB.DURATION_CALL);
clob.putString(1,content);
ps.setClob(1,clob);
ps.executeUpdate();
报错java.sql.SQLException: Io 异常: End of TNS data channel这个要怎么解决?
谢谢!