Easy Tip for Loading Images
into Oracle Tables
Satyanarayana Reddy has published this great tip
for loading images into Oracle tables:
http://www.dba-village.com/village/dvp_tips.TipDetails?TipIdA=2507
Create the table as follows
CREATE TABLE image_table (file_id NUMBER(5),
file_name VARCHAR2(30),file_data BLOB);
Now your control file should be as follows
Control File:
LOAD DATA
INFILE *
INTO TABLE image_table
REPLACE
FIELDS TERMINATED BY ','
(
file_id INTEGER(5),
file_name CHAR(30),
file_id LOBFILE (file_name)
TERMINATED BY EOF
)
BEGINDATA
1,C:\John.gif
2,C:\smith.gif
3,C:\sandra.gif
SQLLDR control=control.ctl log=sqlldr.log
Just query the table to see data has been
successfully loaded or not
Select
file_id,file_name,DBMS_LOB.GETLENGTH(file_data ) Length from
Image_table
..............................
1 C:\John.gif 5400
2 C:\smith.gif 3400
3 C:\sandra.gif 3500
|