Q
Problem solve Get help with specific problems with your technologies, process and projects.

Retrieval time for LONGRAW images is slow

I have a problem saving images into an Oracle 8 database. I saved images as LONGRAW datatype, but it needs a long time to retrieve the image from my archiving system. What is the best way to make this faster?

Instead of using LONGRAW, use BLOB. LOB datatypes (BLOB, LOB, BFILE) are more appropriate choices and much more flexible than the older LONGRAW datatype.

For example, suppose you have a table with the following definition:

CREATE TABLE long_tab ( 
id NUMBER, 
long_col LONG RAW); 
Create a new table using the following SQL statement:
CREATE TABLE lob_tab ( 
id NUMBER, 
clob_col BLOB); 
Issue an INSERT statement using the TO_LOB function to insert the data from the table with the LONG datatype into the table with the LOB datatype.

For example, issue the following SQL statement:

INSERT INTO lob_tab 
SELECT id, 
TO_LOB(long_col) 
FROM long_tab; 
Note: When you create the new table, make sure you preserve the table's schema, including integrity constraints, triggers, grants, and indexes. The TO_LOB function only copies data; it does not preserve the table's schema.

That will get your data into the new table format using a BLOB. Your next step is to read up on how to work with BLOB datatypes. You'll need to get familiar with with DBMS_LOB package for starters. See the Oracle Supplied PL/SQL Packages Reference.

You should get much better overall performance and flexibility.

For More Information


This was last published in March 2003

Dig Deeper on Oracle and SQL

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close