PowerBuilder读取Oracle 的Clob字段内容 发现直接使用SELECTBLOB读取的数据总是有数据不能完全读取问题 最后我在网上进行了搜罗 发现可以写一个FUNCTION来进行处理
Oracle读取Clob函数 一次可以读取 个字符
create or replace function getclob(
table_name in varchar 表名
field_name in varchar CLOB字段名
v_tj in varchar 表查询条件
v_pos in number –字符起始位置)
return varchar is
buffer varchar ( )
lobloc clob;
amount number := ;
query_str varchar ( )
begin
query_str := select ||field_name|| from ||table_name|| where ||v_tj|| ;
initialize buffer with data to be found
EXECUTE IMMEDIATE query_str INTO lobloc ;
read varchar from the buffer
dbms_lob read(lobloc amount v_pos+ buffer)
return buffer;
exception
when no_data_found then
return buffer;
end;
PowerBuilder采用循环读取CLOB字段的所有内容
String ls_temp ls_data ls_data
ls_temp = blbh= +String(ll_blbh)+ and blym= +String(li_blym)
SELECT dbms_lob getlength() INTO :ll_len FROM ys_zy_bl_ Where blbh = :ll_blbh AND blym = :li_blym;
Long i
i =
DO
//调用ORACLE的函数GetClob
SELECT getclob( ys_zy_bl_ :ls_temp :i ) INTO :ls_data FROM dual;
ls_data = ls_data + ls_data
ll_len = ll_len
i = i +
LOOP WHILE ll_len >=
注 ll_blbh li_blym为PowerBuilder变量
简单吧 ls_data 就是需要读取的CLOB字段的全部内容
编辑推荐
ASP NET开发培训视频教程
lishixinzhi/Article/program/PB/201311/24594