Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: OCI 7.3 retrieving Oracle 8 BLOBs?
A copy of this was sent to "I. H. Ting" <ihting_at_usa.net>
(if that email address didn't require changing)
On Tue, 20 Oct 1998 01:17:36 +0100, you wrote:
>Hi All,
>
>Does anyone know whether it is possible to retrieve an Oracle 8 BLOB from an
>OCI 7.3 client?
>
>Thanks in advance for any info.
>
>Regards.
>
>Ting
>
Absolutely if you are willing to use PL/SQL and a package.
Consider this example
drop table blobs;
create table blobs
( id varchar2(255) primary key,
theBlob blob
)
/
create or replace package blobs_pkg
as
g_blob_locator blob;
end;
/
You could then execute PL/SQL blocks from the client that look like:
begin
insert into blobs ( id, theBlob )
values ( :my_bind_variable, empty_blob() )
returning theBlob into blobs_pkg.g_blob_locator;
end;
that would create a row in the blobs table with an empty blob and put the lob locator into a pl/sql package variable. The only bind variable in this case is the :my_bind_variable which is a simple NUMBER and the 7.3 client can deal with this. We never bring the lob locator back to the client -- it doesn't need to understand blobs.
Later you could execute something like:
begin
dbms_lob.write( blobs_pkg.g_blob_locator, 1, :amt, :my_raw ); end;
with 2 bind variables -- the number of bytes to write and the raw bind variable. You would have to chunk reads and writes up 32k at a time (pl/sql can only deal with 32k variables) but since the dbms_lob.read/write procedures give you full piecewise access to the lob, this is not hard to do at all. Again, we only are binding a number and a raw -- something o7.x oci can deal with very well...
This works with any 7.x client (odbc, etc). They can all read/write LOBS using this method...
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
--
http://govt.us.oracle.com/ -- downloadable utilities
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 Oct 20 1998 - 08:32:07 CDT
![]() |
![]() |