我想把所建目录下的文本文件内容存放到TABLE中的CLOB字段中,
但当我在SQL/PLUS执行完过程sp_testlob_1后,发现字段lob1里全是乱码,请教为什么,?create table testlob(
id number,
lob1 clob
);insert into testlob (id,lob1) values(1,'abc');create or replace procedure sp_testlob_1
is
bfTestFile BFILE;
lobReturn CLOB;
begin
select lob1 into lobreturn from testlob where id=1 for update;
bfTestFile := BFILENAME('DIR_LOB_1','lob.txt');
dbms_lob.fileopen(bftestfile,dbms_lob.file_readonly);
dbms_lob.loadfromfile(lobreturn,bftestfile,dbms_lob.getlength(bftestfile));
commit;
dbms_lob.fileclose(bftestfile);
end sp_testlob_1;其中lob.txt为纯文本文件
但当我在SQL/PLUS执行完过程sp_testlob_1后,发现字段lob1里全是乱码,请教为什么,?create table testlob(
id number,
lob1 clob
);insert into testlob (id,lob1) values(1,'abc');create or replace procedure sp_testlob_1
is
bfTestFile BFILE;
lobReturn CLOB;
begin
select lob1 into lobreturn from testlob where id=1 for update;
bfTestFile := BFILENAME('DIR_LOB_1','lob.txt');
dbms_lob.fileopen(bftestfile,dbms_lob.file_readonly);
dbms_lob.loadfromfile(lobreturn,bftestfile,dbms_lob.getlength(bftestfile));
commit;
dbms_lob.fileclose(bftestfile);
end sp_testlob_1;其中lob.txt为纯文本文件
中的'DIR_LOB_1',是不是文件路径呀??
bfTestFile := BFILENAME('C:\\','lob.txt');
我这样怎么不可以呀??
大虾救我呀
gb2312或GBK啊!不要忘记了 ~^~