SQL> create or replace Directory dir1 as 'c:/oracle/';
Directory created.
SQL>
SQL> declare
2 l_bfile bfile;
3 l_clob clob;
4 l_str varchar2(1000);
5 begin
6 insert into t (name,content)
7 values ('b.txt',empty_clob())
8 returning content into l_clob;
9
10 l_bfile := bfilename('DIR1','b.txt');
11
12 dbms_lob.fileopen(l_bfile);
13 dbms_lob.loadfromfile(l_clob,l_bfile,dbms_lob.getlength(l_bfile));
14 dbms_lob.fileclose(l_bfile);
15 commit;
16 exception when others then
17 l_str:=sqlerrm(sqlcode);
18 dbms_output.put_line(l_str);
19 end;
20 /
PL/SQL procedure successfully completed.
SQL> select * from t;
向oracle中clob字段插入数据
最新推荐文章于 2024-04-02 09:04:56 发布