Just learned something new : Oracle has some multimedia database functions. These functions are "JAVA" functions. so It might be a little different from other oracle functions. Multi-media includes: different types of video, image, audio. I am suprised those files can be operated by Oracle. The ORDImage is a class to deal with picutres. the code below was my test of how to convert between this type and blob.
pid varchar2(10) default 'chenz';
v_id number default 0;
Photo blob default null;
Photo2 blob default null;
vx1 number default 0;
vy1 number default 0;
vx2 number default 0;
vy2 number default 0;
vw number default 0;
vh number default 0;
attributes clob;
img_mimeType varchar2(32);
img_contentLength integer;
fileFormat varchar2(32);
img_width integer;
img_height integer;
contentFormat varchar2(32);
compressionFormat varchar2(32);
image1 ORDSYS.ORDIMAGE;
image2 ORDSYS.ORDIMAGE;
opt varchar2(100) default null;
begin
DBMS_LOB.CREATETEMPORARY(attributes, TRUE, DBMS_LOB.CALL);
select max(id) into v_id from directory.staff_pic where name=pid;
select content into Photo from directory.staff_pic where id=v_id ;
for i in (select * from directory.staff_pic where id=v_id) loop
Photo :=i.content;
vx1:=i.x1;
vx2:=i.x2;
vy1:=i.y1;
vy2:=i.y2;
vw:=i.width;
vh:=i.height;
end loop;
opt:='cut='||vx1||' '||vx2||' '||vw||' '||vh||'';
-- htp.p(opt);
ORDSYS.ORDImage.getProperties(Photo,
attributes,
img_mimeType,
img_width,
img_height,
fileFormat,
compressionFormat,
contentFormat,
img_contentLength);
select ordsys.ordimage(ordsys.ordsource( photo, null, null, null, null, 1),
null, null, null, null, null, null, null)
into image1 from dual;
image1.setProperties( );
------------------------------------------------------------------------------
----------Code below is to convert Ordimage to Blob--------
------------------------------------------------------------------------------
photo2:=ordsys.ordimage.getContent(image1);
owa_util.mime_header('image/jpeg', FALSE, NULL);
wpg_docload.download_file(Photo2);
end test3;
end test;