This content has been marked as final. Show 3 replies
The error message is telling you what the problem is, the LOB locator is not properly initialized. LOB locators are of two types: permanent and temporary. Permanent locators are created using the EMPTY_LOB() function in the context of a SQL INSERT or UPDATE statement. That is the locator is inserted a new row, or updating and existing row in a table. This will create a valid locator then can be used in subsequent calls. A temporary LOB locator is created with a call to DBMS_LOB.CREATETEMPORARY().
The ORDIMAGE.init() function you are using, uses the EMPTY_LOB() initializer and thus works properly only in the context of an INSERT or UPDATE statement. Here you have a standalone PL/SQL statement.
If your intention is to permanently store image_2 in the database, then you should create the ORDIMAGE by iniitializing the column in the table and returning it to the PL/SQL program. Then you can use it as the destination of the copy() call of image_1.
Have you studied the PL/SQL Quick Start code examples available from the right hand side of the Multimedia home page?
It seems that ordimage.init() doesn't use empty_lob() when used in PL/SQL statement.
I managed to use ORDImage type instead BLOB.
create or replace procedure dicom_export_jpeg (source_id number, filename varchar2) as
ctx raw(48) := NULL;
newImg := ordsys.ORDImage.init();
SELECT dicom INTO dcmSrc
FROM MEDICAL_IMAGE_TABLE WHERE id=source_id;
newImg.export(ctx, 'FILE', 'IMAGEDIR', filename);
--ORDSYS.ORDIMAGE.export(ctx, newImg, 'FILE', 'IMAGEDIR', 'test2.jpeg');