1.向blob字段插入文本
INSERT INTO lobdemo (key, clob_col, blob_col, bfile_col) VALUES (51, 'This is another character literal', HEXTORAW('ABABABABABABABABABAB'), NULL);
2.更新blob字段文本
UPDATE peoplesoft SET SUPPLIER_ID = HEXTORAW('CDCDCDCDCDCDCDCDCDCDCDCD') where rownum =2;
update PEOPLESOFT_1M set supplier_id = utl_raw.cast_to_raw(vendor_id) ;
3.向blob字段插入文件
CREATE TABLE yuser (ID number,photo BLOB);
create or replace directory images as '/test';
declare
l_bfile bfile;
l_blob blob;
begin
insert into yuser(ID,photo) values(1,empty_blob())
return photo into l_blob;
l_bfile:=bfilename('IMAGES','test.doc'); --IMAGES 是上面创建目录的大写
dbms_lob.open(l_bfile,dbms_lob.file_readonly);
dbms_lob.loadfromfile(l_blob,l_bfile,dbms_lob.getlength(l_bfile));
dbms_lob.close(l_bfile);
commit;
end;
/
update的方式
declare
l_bfile bfile;
l_blob blob;
begin
update yuser set photo = empty_blob() where id = 2
return photo into l_blob;
l_bfile:=bfilename('IMAGES','PS.pdf');
dbms_lob.open(l_bfile,dbms_lob.file_readonly);
dbms_lob.loadfromfile(l_blob,l_bfile,dbms_lob.getlength(l_bfile));
dbms_lob.close(l_bfile);
commit;
end;
、
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。