Solved

extract data from oracle db question

Posted on 2008-06-24
3
659 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 76

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 76

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now