3 Replies Latest reply: Aug 18, 2010 7:28 AM by 600743 RSS

    ORDImage Copy

    mesut
      Hi everyone,
      I am trying to copy image object.(DB 11.1.0.6.0)
      My test script is

      declare
      image_1 ORDSYS.ORDImage;
      image_2 ORDSYS.ORDImage;
      begin
      image_2:=ORDSYS.ORDIMAGE.INIT();
      SELECT img INTO image_1 FROM images;
      image_1.copy(image_2);
      end;

      When I run the script , I have an exception at copy function

      ORA-22275:invalid LOB locator specified
      ORA-06512: at "SYS.DBMS_LOB",line 909

      Edited by: mesut on Apr 7, 2009 10:44 PM
        • 1. Re: ORDImage Copy
          251301
          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?

          Robert
          • 2. Re: ORDImage Copy
            mesut
            Thanks Robert
            I solved my problem

            declare
            image_1 BLOB;
            image_2 BLOB;
            begin
            DBMS_LOB.CREATETEMPORARY(image_2,TRUE, DBMS_LOB.SESSION);
            SELECT img INTO image_1 FROM images;
            ORDSYS.ORDIMAGE.processCopy(image_1,'maxscale=100 100',image_2);

            ...

            DBMS_LOB.FREETEMPORARY(image_2);
            end;
            • 3. Re: ORDImage Copy
              600743
              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

              dcmSrc ordsys.ORDDicom;
              newImg ordsys.ORDImage;
              ctx raw(48) := NULL;
              BEGIN
              newImg := ordsys.ORDImage.init();
              DBMS_LOB.CREATETEMPORARY(newImg.source.localData,TRUE, DBMS_LOB.SESSION);

              SELECT dicom INTO dcmSrc
              FROM MEDICAL_IMAGE_TABLE WHERE id=source_id;
              dcmSrc.processCopy('fileformat=jfif', newImg);
              newImg.export(ctx, 'FILE', 'IMAGEDIR', filename);
              --ORDSYS.ORDIMAGE.export(ctx, newImg, 'FILE', 'IMAGEDIR', 'test2.jpeg');
              DBMS_LOB.FREETEMPORARY(newImg.source.localData);
              END;

              /