INSERT INTO LONG RAW

In this forum you can share stuff related to Oracle 11g, 10g, 9i.
Post Reply
antojoen
Posts: 6
Joined: Fri Nov 23, 2007 5:59 pm
Location: United Arab Emirates

INSERT INTO LONG RAW

Post by antojoen »

Hi Friends,

I have a requirement.

I am using oracle 10g. I want to insert employee photographs into the system. For this i am using a column datatype is LONG RAW. How to insert all the employee data through an conversion.

Through oracle forms i can achive this. But its a manual work. I want to do this in one shot through back end. Because the number of employees are more.

Server OS: Linux

Please anyone having knowledge on this please help me in this.

Thanks,
Antojoen
amirtai
Posts: 138
Joined: Sat Apr 08, 2006 5:54 pm
Location: Canada
Contact:

Post by amirtai »

Hi there

Sorry for the late reply. I don't see any reason to use LONG data type in 10g database! Oracle strongly recommend to use and convert existing data to the LOB data types (BFILE) in 10g, it exists only for backward compatibility.

A BFILE column or attribute stores a file locator that points to the external file containing the data. The file to be loaded as a BFILE does not have to exist at the time of loading; it can be created later. SQL*Loader assumes that the necessary directory objects have already been created (a logical alias name for a physical directory on the server's file system).
You could simply use SQL Loader to insert bulk data into the table, here's an example to give you some idea.

A control file field corresponding to a BFILE column consists of a column name followed by the BFILE clause. The BFILE clause takes as arguments a directory object (the server_directory alias) name followed by a BFILE name. Both arguments can be provided as string constants, or they can be dynamically loaded through some other field.

Control File Contents

LOAD DATA
INFILE sample.dat
INTO TABLE planets
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(pl_id NUMBER(4),
pl_name CHAR(20),
fname FILLER CHAR(30),
1 dname FILLER CHAR(20),
pl_pict BFILE(dir_name, file_name) )


Datafile (sample.dat)

1, Mercury, mercury.jpeg, scott_dir1,
2, Venus, venus.jpeg, scott_dir1,
3, Earth, earth.jpeg, scott_dir2,

Regards
Amir
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest