DEVFYI - Developer Resource - FYI

How does one use SQL*Loader to load images, sound clips and documents? (for DBA

ORACLE Interview Questions and Answers (Part 5)


(Continued from previous question...)

891. How does one use SQL*Loader to load images, sound clips and documents? (for DBA

SQL*Loader can load data from a "primary data file", SDF (Secondary Data file - for loading nested tables and VARRAYs) or LOGFILE. The LOBFILE method provides and easy way to load documents, images and audio clips into BLOB and CLOB columns. Look at this example:
Given the following table:
CREATE TABLE image_table (
image_id NUMBER(5),
file_name VARCHAR2(30),
image_data BLOB);
Control File:
LOAD DATA
INFILE *
INTO TABLE image_table
REPLACE
FIELDS TERMINATED BY ','
(
image_id INTEGER(5),
file_name CHAR(30),
image_data LOBFILE (file_name) TERMINATED BY EOF
)
BEGINDATA
001,image1.gif
002,image2.jpg

(Continued on next question...)

Other Interview Questions