ASP - Reading blob from Oracle to ASP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajitp
    New Member
    • Feb 2006
    • 2

    ASP - Reading blob from Oracle to ASP

    Hi,

    I am having serious trouble retreiving a blob from a oracle table.
    The pictures are stored in the database and I need to retreive the pictures and display it on a page.

    Can anyone help me please.

    Thanks
    Ajit.P
  • Niheel
    Recognized Expert Moderator Top Contributor
    • Jul 2005
    • 2432

    #2
    * moved thread to database help
    niheel @ bytes

    Comment

    • Niheel
      Recognized Expert Moderator Top Contributor
      • Jul 2005
      • 2432

      #3
      Are you having a hard time with the writing the query? or are you getting error messages with a query you already wrote.

      If you have written code; please paste in here using the CODE tags.
      niheel @ bytes

      Comment

      • ajitp
        New Member
        • Feb 2006
        • 2

        #4
        Originally posted by KUB365
        Are you having a hard time with the writing the query? or are you getting error messages with a query you already wrote.

        If you have written code; please paste in here using the CODE tags.
        The following is the procedure i have written to retrieve the blob
        The procedure prints out the blob if i execute in oracle.

        The table structure is an id (number) and theblob (blob)

        I need to know how to pass the output of the procedure to an asp page.


        Code:
         CREATE OR REPLACE PROCEDURE Read_Text_From_BLOB ( 
        p_id IN NUMBER)
        IS
         
         
        l_amt number default 30;
        l_off number default 1;
        l_raw raw(4096); 	
        lob_loc BLOB;
         
        BEGIN
         
         
         
         
        SELECT theblob INTO lob_loc
        FROM a1
        WHERE id = p_id;
         
         
        owa_util.mime_header( 'image/gif' );
         
         
        	begin
        loop
        dbms_lob.read( lob_loc, l_amt, l_off, l_raw );
         
        htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
        l_off := l_off+l_amt;
        l_amt := 4096;
        end loop;
         
        exception
        when no_data_found then 
        NULL;
        end;
         
        DBMS_OUTPUT.PUT_LINE( 
        UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(lob_loc, 200, 1))
        );
         
         
        END;
        /
        Last edited by Niheel; Feb 6 '06, 05:56 PM.

        Comment

        • madeofrose
          New Member
          • Nov 2006
          • 2

          #5
          i have the same problem with regular asp 3.0 vbscript code.
          How asp page can get the Blob type data from oracle

          Thanks for any help

          Originally posted by ajitp
          The following is the procedure i have written to retrieve the blob
          The procedure prints out the blob if i execute in oracle.

          The table structure is an id (number) and theblob (blob)

          I need to know how to pass the output of the procedure to an asp page.


          Code:
           CREATE OR REPLACE PROCEDURE Read_Text_From_BLOB ( 
          p_id IN NUMBER)
          IS
           
           
          l_amt number default 30;
          l_off number default 1;
          l_raw raw(4096); 	
          lob_loc BLOB;
           
          BEGIN
           
           
           
           
          SELECT theblob INTO lob_loc
          FROM a1
          WHERE id = p_id;
           
           
          owa_util.mime_header( 'image/gif' );
           
           
          	begin
          loop
          dbms_lob.read( lob_loc, l_amt, l_off, l_raw );
           
          htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
          l_off := l_off+l_amt;
          l_amt := 4096;
          end loop;
           
          exception
          when no_data_found then 
          NULL;
          end;
           
          DBMS_OUTPUT.PUT_LINE( 
          UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(lob_loc, 200, 1))
          );
           
           
          END;
          /

          Comment

          • Rkapoor123
            New Member
            • Jul 2008
            • 1

            #6
            Has anyone answered your request or have you found the solution?

            Comment

            Working...