Solved

extract data from oracle db question

Posted on 2008-06-24
3
670 Views
Last Modified: 2013-12-19
I currently use Oracle web application server. A DAD is Oracle web server's Data Access Descriptor
that is set up in the above web application server. I am using pl/sql web toolkit in the remote Oracle DB.

The applications are accesed on the web using url like below
http://testco.domain.com/DAD/testapp.

in the above URL, testapp is a Oracle stored procedure which uses pl/sql web toolkit.
---
The table from which I am trying extract the image (stored in the BLOB) is like this
desc test_image
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 IMAGE_NAME                                         VARCHAR2(30)
 IMAGE_CONTENT                                      BLOB
--
The stored procedure which I use to display this image in the web looks like this
--
create or replace PROCEDURE testapp  IS
  v_blob  BLOB;
  v_amt   NUMBER := 30;
  v_off   NUMBER := 1;
  v_raw   RAW(4096);
BEGIN
  SELECT image_content
  INTO   v_blob
  FROM   test_image;

  Owa_Util.Mime_Header('image/jpeg');

  BEGIN
    LOOP
      Dbms_Lob.Read(v_blob, v_amt, v_off, v_raw);

      Htp.Prn(Utl_Raw.Cast_To_Varchar2(v_raw));
      v_off := v_off + v_amt;
      v_amt := 4096;
    END LOOP;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      NULL;
  END;
END;
/
-------------
http://testco.domain.com/DAD/testapp does not show the image properly.
It shows the broken image.

Any input welcome.
0
Comment
Question by:aarch1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 21868088
Let me start off by first saying I've never used the web app server.  I'm just here from the moderator's request.

My guess is it's the cast_to_varchar.  I stumbled across a different function.  Not sure exactly what it does but it sure looks good.

try changing:
Htp.Prn(Utl_Raw.Cast_To_Varchar2(v_raw));
to
Htp.Putraw(v_raw);
0
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 21868140
did a quick google.

See if this article is what you're after:
http://joegarrepy.com/oracle_webimage.htm
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question