PL/SQL中CLOB和BLOB存储(BLOB fileopen问题)

处理BLOB首先:
create directory user_dir as 'E:\BFILE_DEMO';
grant read,write on directory user_dir to TEST;
create or replace procedure UPD_CLOB_PRO(P_ID   number,P_CLOB   varchar2,P_FILENAME varchar2) is

--CLOB
v_CLOB clob;
amount number;
offset number;
--BLOB
v_BLOB blob;
v_file BFILE;
blob_amount number;
src_offset number:=1;
dest_offset number:=1;

begin
   --更新CLOB
    select TEST_CLOB into v_CLOB from  TEST_TB where TEST_BM  = P_ID for update;
     offset :=dbms_lob.getlength(v_CLOB)+1;
     amount :=length(P_CLOB);
     dbms_lob.write(v_CLOB,amount,offset,P_CLOB);
     commit;
   --更新BLOB
    select TEST_BLOB into v_BLOB from  TEST_TB where TEST_BM  = P_ID for update;
    v_file :=BFILENAME('USER_DIR',P_FILENAME);
    dbms_lob.fileopen(v_file);
    blob_amount :=dbms_lob.getlength(v_file);
    dbms_lob.loadblobfromfile(v_BLOB,v_FILE,blob_amount,dest_offset,src_offset);
    dbms_lob.fileclose(v_file);
    commit;
end UPD_CLOB_PRO;
BLOB 部分报错:ORA-22288 : 文件或LOBster操作FILEOPEN失败,设备未就绪
请达人指教

转载于:https://www.cnblogs.com/j6043157/archive/2009/08/19/1550001.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值