Use dbms_lob for load clob data from file
SQL>
SQL>
SQL> create or replace directory dir1 as 'c:\temp\';
Directory created.
SQL>
SQL> create or replace directory "dir2" as 'c:\temp\';
Directory created.
SQL>
SQL> create table demo
2 ( id int primary key,
3 theClob clob
4 )
5 /
Table created.
SQL>
SQL> declare
2 l_clob clob;
3 l_bfile bfile;
4 begin
5 insert into demo values ( 1, empty_clob() )
6 returning theclob into l_clob;
7
8 l_bfile := bfilename( 'DIR1', 'test.txt' );
9 dbms_lob.fileopen( l_bfile );
10
11 dbms_lob.loadfromfile( l_clob, l_bfile,dbms_lob.getlength( l_bfile ) );
12
13 dbms_lob.fileclose( l_bfile );
14 end;
15 /
declare
*
ERROR at line 1:
ORA-22288: file or LOB operation FILEOPEN failed
The system cannot find the path specified.
ORA-06512: at "SYS.DBMS_LOB", line 523
ORA-06512: at line 9
SQL>
SQL> select dbms_lob.getlength(theClob), theClob from demo
2 /
no rows selected
SQL>
SQL>
SQL> drop table demo;
Table dropped.
SQL>
SQL>
SQL>
SQL> --
Related examples in the same category