Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: LONG RAW read/write

Re: LONG RAW read/write

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Tue, 17 Nov 1998 13:43:13 GMT
Message-ID: <36517c48.1398761@192.86.155.100>


A copy of this was sent to Yasemin Ugur <yasemin_at_wins.uva.nl> (if that email address didn't require changing) On Tue, 17 Nov 1998 10:15:56 +0100, you wrote:

>Hello everybody,
> I need urgent help about my problem.Here it is:
> We are using Oracle 7.3 to support some of our projects. In a project,
>we have to store and retrieve data of LONG RAW type. We have a table
>for this data with the following definition:
>
> BLOB (id NUMBER, context LONG RAW)
>
>There are two different ways in which we need to read/write data of this
>type:
>1. Using the following stored procedures/functions within PL/SQL block:
> PutBlob (context IN BLOB.context%TYPE,status OUT INTEGER)
> RETURN INTEGER;
> Getblob (blobid IN INTEGER,context OUT BLOB.context%TYPE,
> status OUT INTEGER);
>
>Question: How do we assign a value to the 'context' parameter before
>invoking the functions? We know it is possible using a string of
>hexadecimal or binary characters, but we would like to avoid any kind of
>conversion of the actual data to such string. Can anybody provide us
>with some examples of how to call stored procedures having LONG RAW
>parameters?
>

from what environment are you planning on calling these stored procedures? pro*c, oci, odbc, http, etc....

>2.Using OCI functions in C++.
>We also need to write/read data into the table using OCI functions from
>C++ directly. How can we insert/read LONG RAW data elements using OCI
>functions from C/C++? We found some examples in the ORACLE on-line
>documentation that we have, but they don't work properly.
>

You might want to download the 'owarepl' cartridge from http://govt.us.oracle.com/ under the 'downloadable utilities' link. Once you grab the source for this cartridge and untar (unzip) it, you'll find 2 subdirectories -- owarepl/src/load, owarepl/src/unload. Load and Unload write and read long raws.

Load is code for a simple long raw loader into my 'image' table (4 columns, one of which is the long raw). It demonstrates piecewise inserts by reading an OS file 64k at a time and writing it piece by piece into the database.

Unload is a little more generic. It can unload a long raw column into OS files and does so using piecewise fetches. You give it a query like:

$ unload scott/tiger "select long_raw_column, rownum || '.dat' from T"

and it will unload each row of T into a separate file called 1.dat, 2.dat and so on...

Its all in source code form, hope it helps.

>We would apreciate if anybody can help us on these problems.
>Thanks in advance,
>
>Yasemin Ugur
>
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Tue Nov 17 1998 - 07:43:13 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US