3 Replies Latest reply: Sep 17, 2012 5:38 PM by 721705 RSS

    getProperties( ) (all attributes) for BLOBs

    Mindmap
      Hello,
      I am using Oracle 11g R2 SOE.
      I am trying to practice this example that is similar to the one in the doc about :
      getProperties( ) (all attributes) for BLOBs
      But nothing gets updated in my table, even though it tells on the output 1 row is updated (as you can see below)
      if I change the statement into Insert, it works perfectly.
      What could be the reason ????
      DECLARE
        img_data              BLOB;
        img_attrib        CLOB;
        mimeType          VARCHAR2(4000);
        width             NUMBER;
        height            NUMBER;
        fileFormat        VARCHAR2(32);
        contentFormat     VARCHAR2(4000);
        compressionFormat VARCHAR2(4000);
        contentLength     NUMBER;
      BEGIN
         SELECT content, attrib, mimtype, width, height, fileformat, contentformat,
           compressionformat, contentlength INTO img_data, img_attrib, mimeType, width,
           height, fileFormat, contentFormat, compressionFormat, contentLength 
           FROM com_photos WHERE id = 1012 FOR UPDATE;
      
        ORDSYS.ORDImage.getProperties(img_data, img_attrib, 
               mimeType, width, height, fileFormat,
               contentFormat, compressionFormat, contentLength);
      
         DBMS_OUTPUT.put_line('Size of XML Annotations ' ||
                         TO_CHAR(DBMS_LOB.GETLENGTH(img_attrib)));
         DBMS_OUTPUT.put_line('mimeType: ' || mimeType );
         DBMS_OUTPUT.put_line('width: ' || width );
         DBMS_OUTPUT.put_line('height: ' || height );
         DBMS_OUTPUT.put_line('fileFormat: ' || fileFormat );
         DBMS_OUTPUT.put_line('contentFormat: ' || contentFormat );
         DBMS_OUTPUT.put_line('compressionFormat: ' || compressionFormat );
         DBMS_OUTPUT.put_line('contentLength: ' || contentLength );
         UPDATE com_photos SET 
             content=img_data, 
             attrib=img_attrib, 
             mimtype=mimeType, 
             width=width, 
             height=height, 
             fileformat=fileFormat, 
             contentformat=contentFormat, 
             compressionformat=compressionFormat, 
             contentlength=contentLength 
          WHERE id = 1012;
         COMMIT;
      EXCEPTION
         WHEN OTHERS THEN
         RAISE;
      END;
      and I get this result
      Size of XML Annotations 
      mimeType: image/jpeg
      width: 800
      height: 500
      fileFormat: JFIF
      contentFormat: 24BITRGB
      compressionFormat: JPEG
      contentLength: 55966
      
      1 row(s) updated.
      Another point, I am interested in getting only the width and the height of the image, but as I got i have to feed ORDSYS.ORDImage.getProperties with all parameters. Is there a way to get around ?

      Best regards,
      Fateh