Solved

extract data from oracle db question

Posted on 2008-06-24
3
668 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Procedure syntax 5 63
Oracle mutateing errors 3 26
Excess Redo 3 48
SQL Syntax Question 9 56
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…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

734 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