conn system/system
grant create any directory to test;
conn test/test
create table demo (id int primary key,theclob clob);
create or replace directory my_file as ‘d:’;
create or replace procedure load_a_file(p_id in number,
p_filename in varchar2) as
l_clob clob;
l_bfile bfile;
begin
insert into demo
values
(p_id, empty_clob())
returning theClob into l_clob;
l_bfile := bfilename('MY_FILES', p_filename);
dbms_lob.fileopen(l_bfile);
dbms_lob.loadfromfile(l_clob, l_bfile, dbms_lob.getlength(l_bfile));
dbms_lob.fileclose(l_bfile);
end;
exec load_a_file( 1, 'index.html' );
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8118583/viewspace-64845/,如需转载,请注明出处,否则将追究法律责任。