We all know that lob data processing is very annoying. After the database design is complete, we often need to load test data, which is also annoying for lob. We can use SQL * loader to implement it, following is the control file:
Load data
Infile *
Into Table big_table
Replace
Fields terminated by X '09' optionally enclosed '"'
Trailing nullcols
(
XX _ id integer external,
Xx_name char,
Video_file filler char,
Video lobfile (video_file) terminated by EOF nullif value_file = 'null'
)
Begindata
1 matrix3 martrix3.mpg
2 "Lord of Ring" ring3.avi
3 "Top 10 of Week" top10_3.ra
Note:
Filler is the reserved word of loader, indicating that video_file is a variable instead of a field name. filler char indicates a string variable, which is used for subsequent lobfile
Lobfile is the loader function, indicating that the value of this field is obtained from lobfile
Terminated by EOF indicates that each lob field in each row comes from an independent File
==============
Supplement:
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)