Test-use SQL Lorader to import lob data, loraderlob
1. Prepare the data file to be transferred and transfer it to the server
2. Create a target table in the database
DROP TABLE lob_tab;CREATE TABLE lob_tab ( number_content NUMBER(10), varchar2_content VARCHAR2(100), date_content DATE, clob_content CLOB, blob_content BLOB);
3. Compile the control file for SQL Loader (Name: lob_test.ctl)
LOAD DATA INFILE 'lob_test_data.txt' INTO TABLE lob_tab FIELDS TERMINATED BY ',' (number_content CHAR(10), varchar2_content CHAR(100), date_content DATE "DD-MON-YYYY" ":date_content", clob_filename FILLER CHAR(100), clob_content LOBFILE(clob_filename) TERMINATED BY EOF, blob_filename FILLER CHAR(100), blob_content LOBFILE(blob_filename) TERMINATED BY EOF)
It is worth noting that the filename field is defined as the FILLER type, which provides LOBFILE information during transmission and does not pass in to the database.
4. Use the following command to import data to the database
sqlldr userid=test/test@db10g control=lob_test.ctl log=lob_test.log bad=lob_test.bad
After the command is executed using explain Term, the import is successful.