getting image from database to the form. [message #136894] |
Mon, 12 September 2005 02:36 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
summisush
Messages: 19 Registered: September 2005 Location: mumbai
|
Junior Member |
|
|
i've used the following procedure to retrieve image from the oracle database to the form at run time.
PROCEDURE getimagefromdatabase ( p_id in emp_img.idcode%type )
is
l_lob blob;
l_amt number default 30;
l_off number default 1;
l_raw raw(4096);
begin
select emp_img into l_lob
from emp_img
where idcode = p_id;
-- make sure to change this for your type!
owa_util.mime_header( 'image/gif' );
begin
loop
dbms_lob.read( l_lob, l_amt, l_off, l_raw );
-- it is vital to use htp.PRN to avoid
-- spurious line feeds getting added to your
-- document
htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
l_off := l_off+l_amt;
l_amt := 4096;
end loop;
exception
when no_data_found then
NULL;
end;
end;
1) But the problem is when i compile the form , application gets closed automatically.
2) And i don't understand the significance of
l_amt , l_off , l_raw.
3) my table EMP_IMG is as follows:
Name Null? Type
------------------------------- -------- ----
IDCODE NOT NULL CHAR(6)
EMP_IMG BLOB
i want to display the image in Emp_img.emp_img into :image
(:image is an image item on the form.).
Please help.
|
|
|
Re: getting image from database to the form. [message #136899 is a reply to message #136894] |
Mon, 12 September 2005 03:41 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
summisush
Messages: 19 Registered: September 2005 Location: mumbai
|
Junior Member |
|
|
after trying a simple solution which usually we use to retrieve data...
my problem got solved...
I just cretaed data block of the table emp_img.
and uesd execute_query(no_validate);
and the image is solved...
there was no need of the procedure at all....
|
|
|