Skip to content

Images don't work #11

@just-doit

Description

@just-doit

Procedure p_putstream(pData in out NOCOPY blob) doesn't handle the blob data correctly. By reading them into a varchar2 variable, it get's converted into the hex representation.

The following change works for me:

PROCEDURE p_putstream (pdata IN OUT NOCOPY BLOB)
   IS
      offset              INTEGER := 1;
      lv_content_length   NUMBER := DBMS_LOB.getlength (pdata);
      buf_size            INTEGER := 2000;
      buf                 RAW (2000);
   BEGIN
      p_out ('stream');

      -- read the blob and put it in small pieces in a varchar
      WHILE offset <= lv_content_length
      LOOP
         DBMS_LOB.read (pdata, buf_size, offset, buf);
         p_out (UTL_RAW.cast_to_varchar2 (buf), FALSE);
         offset := offset + buf_size;
      END LOOP;

      -- put a CRLF at te end of the blob
      p_out (CHR (10), FALSE);
      p_out ('endstream');
   EXCEPTION
      WHEN OTHERS
      THEN
         error ('p_putstream : ' || SQLERRM);
   END p_putstream; 

I've changed the < into a <= in the while loop as well, btw.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions