Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

extract data from oracle db question

Posted on 2008-06-24
3
Medium Priority
?
673 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
  • 2
3 Comments
 
LVL 78

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 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 1500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
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 explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database

885 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