Solved

extract data from oracle db question

Posted on 2008-06-24
3
663 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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
levels for reporting 5 63
Oracle Database creation fails 5 49
Oracle Finance  implemmentation   On-Premises vs Manage service vs Cloude 3 77
T-SQL Convert to PL/SQL 23 77
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

919 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

16 Experts available now in Live!

Get 1:1 Help Now