This content has been marked as final. Show 3 replies
Using BLOB, it works ...
If one day someone can explain why it don't works using ordimage, please let me know.
create or replace procedure show_photo_thumbnail(v_id_photo in number, v_height in number, v_width in number) as obj blob; obj2 blob; begin select p.phot_source.source.localdata into obj from photos p where p.phot_id = v_id_photo for update; ordimage.processcopy(obj,'maxscale= '||v_width||' '||v_height, obj2); wpg_docload.download_file(obj2); end;
It should work exactly the same for ORDimage and BLOBs, as ORDImage stores and updates the image content in a BLOB attribute.
The difference you are seeing might be because of which object you are reading. In the first example, obj2 was selected for update, but obj1 was not. So the local variable obj1 had the old data which was printed out, and this was different from the data in obj2, which had the changes that were updated in the table.
If you don't want to persist the updated image, then you can select for update, make changes as you are currently, but then rollback at the very end (after you download the content). Then the original image will be retained in the table and changes you made in this transaction will be discarded. The next time you run the procedure you will be operating on the original image.
I also notice you have a commit in the very first code snippet but not later. Depending on your logging settings that might be having an impact as well.