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: Retrieve Oracle BLOB into asp

Re: Retrieve Oracle BLOB into asp

From: Mark Tomlinson <marktoml_at_gdi.net>
Date: Thu, 03 Dec 1998 16:53:00 GMT
Message-ID: <3666c124.89158573@newshost.us.oracle.com>


OO4O 2.x is non-Oracle 8 aware (thus it understands a BLOB type not). Here is the start of a package you can use to encapsulate access to LOB data which will then let you get it via OO4O. The 3.x release of OO4O will support this natively.

So you call READ_LOB.SETUP_BLOB(x) and then call READ_LOB.GET_CHUNK() in a loop until done. OO4O 2.x can bind the RAW type out of the procedure without problem.

CREATE OR REPLACE package READ_LOB as

   g_blob blob;
   g_part number := -1;

        PROCEDURE Get_Chunk(chunk IN OUT RAW, num in out number);   PROCEDURE SETUP_BLOB(x IN NUMBER); END READ_LOB;

CREATE OR REPLACE package body READ_LOB as     
	PROCEDURE Get_Chunk(chunk IN OUT RAW, num in out number) is

	V_CHUNK RAW(4000);     
  V_AMOUNT number := 4000;     
  begin     
		if g_part = -1 then     
		  g_part := 1;     
     end if;     
		DBMS_LOB.READ(g_blob,V_AMOUNT,g_part,V_CHUNK);     
     chunk := v_chunk;     
     g_part := g_part + V_AMOUNT;     
	  num := g_part;     
   exception     
	   when NO_DATA_FOUND then      
       g_part := -1;     
       num := -1;     
	end get_chunk;     
     
  PROCEDURE SETUP_BLOB(x IN NUMBER) is     
  begin     
		select blob_col into g_blob from blob_read_test where
id = x;     
  END SETUP_BLOB;     
END READ_LOB;     



Received on Thu Dec 03 1998 - 10:53:00 CST

Original text of this message

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