如何用存储过程读取CLOB类型的字段
1个回答
展开全部
create or replace procedure get_news
as
v_varchar VARCHAR2(1000);
v_start PLS_INTEGER := 1;
v_buffer PLS_INTEGER := 1000;
begin
dbms_output.enable(1000000);
for rec in (select test,name,value from test) loop
FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(rec.value) / v_buffer) LOOP
dbms_output.put_line('value是CLOB类型,从'||v_start||'起获取:'||DBMS_LOB.SUBSTR(rec.value, v_buffer, v_start));
v_start := v_start + v_buffer;
end loop;
end loop;
end;
as
v_varchar VARCHAR2(1000);
v_start PLS_INTEGER := 1;
v_buffer PLS_INTEGER := 1000;
begin
dbms_output.enable(1000000);
for rec in (select test,name,value from test) loop
FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(rec.value) / v_buffer) LOOP
dbms_output.put_line('value是CLOB类型,从'||v_start||'起获取:'||DBMS_LOB.SUBSTR(rec.value, v_buffer, v_start));
v_start := v_start + v_buffer;
end loop;
end loop;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询