Poor quality in images from blob field

Post Author: pbrand
CA Forum: .NET
I am using Visual Studio 2005 SP1 along with Crystal Reports XI R2SP1.  I have created a dataset for my report which has several BLOB fields that contain images.  One of the images is of a National Instruments graph control.  All images appear to be of lower quality than the original images when I print the report.  For instance the graph shows quite a bit of compression artifacts around the plots and text.  I have tried turning on the "Retain Original Image Color Depth" setting which had no effect on the quality of the printout that I could see.  It appears that Crystal Reports is compressing the images. Is there a better way of printing images in a Crystal Report?  Basically what I am doing now is taking the images, converting them to byte arrays and loading them into the dataset's BLOB fields.  Then printing the report.  I have thought about using the chart control in Crystal Reports but it does not have all the functionality that I require.  Is there some way to copy the NI graph control directly to the report?  I can live with lower quality on the other images, but I need the graph to be as sharp as possible.If I can't find a solution to this I will have to drop Crystal Reports and find something else.

Post Author: pbrand
CA Forum: .NET
I am using Visual Studio 2005 SP1 along with Crystal Reports XI R2SP1.  I have created a dataset for my report which has several BLOB fields that contain images.  One of the images is of a National Instruments graph control.  All images appear to be of lower quality than the original images when I print the report.  For instance the graph shows quite a bit of compression artifacts around the plots and text.  I have tried turning on the "Retain Original Image Color Depth" setting which had no effect on the quality of the printout that I could see.  It appears that Crystal Reports is compressing the images. Is there a better way of printing images in a Crystal Report?  Basically what I am doing now is taking the images, converting them to byte arrays and loading them into the dataset's BLOB fields.  Then printing the report.  I have thought about using the chart control in Crystal Reports but it does not have all the functionality that I require.  Is there some way to copy the NI graph control directly to the report?  I can live with lower quality on the other images, but I need the graph to be as sharp as possible.If I can't find a solution to this I will have to drop Crystal Reports and find something else.

Similar Messages

  • Display image from BLOB field (png image)

    Hello,
    On my database i have a function which return BLOB (png image from a webservice)..
    Is there some tutorial or sample code how to display a image froma blob field in oracle reports?
    thank you

    You can create a view and base your report on that view. The view would be something like:
    create or replace view my_view as
    select my_blob_function() image
    from ...In your Report it would just be:
    select image
    from my_viewNow, I'm not sure if Reports supports png format, though.
    There are many examples to be found, e.g.
    http://download.oracle.com/docs/html/B10602_01/orbr_dyngraph.htm

  • CRXIR2 image from blob field and some fonts not displaying in PDF export

    I used CRXIR2 developer edition to create a report linked to a SQL 2000 database table.  There is a blob field containing a JPG image that is different for each record in the table.  I am using VB.NET code with ASP.NET 2.0 to programmatically change the temp file to a local folder for easy cleanup, open this crystal report with the 11.5.3700.0 version of the assemblies, set the datasource to a DataTable extracted from the DB, and then export to a PDF file.
    The code for creating the PDF is:
            Dim TempRoot As String = MapPath(".") & "\temp\"
            Dim oldTmp As String = System.Environment.GetEnvironmentVariable("TMP")
            System.Environment.SetEnvironmentVariable("TMP", TempRoot)
            Dim objReport As New ReportDocument()
            objReport.Load(MapPath(".") & "\CReports\" & ReportName)
            For lnX As Integer = 0 To objReport.Database.Tables.Count - 1
                    objReport.Database.Tables(lnX).SetDataSource(resultTable)
            Next
            Dim objDestinationOptions As New DiskFileDestinationOptions()
            Dim objExportOptions As New ExportOptions()
            Dim objFormatTypeOptions As New CrystalDecisions.Shared.PdfRtfWordFormatOptions()
            Dim pdfName As String = "test.pdf"
            objDestinationOptions.DiskFileName = MapPath(".") & "\temp\" & pdfName
            objExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat
            objExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
            objExportOptions.ExportDestinationOptions = objDestinationOptions
            objReport.Export(objExportOptions)
            objReport.Dispose()
            System.Environment.SetEnvironmentVariable("TMP", oldTmp)
    When I run the site locally in VS2008, everything works fine and a PDF contains the graph and all the fonts are correct.
    However, when I run the exact same site from a web server running IIS6, the PDF generated does not have the image, and some of the fonts are substituted (all of the necessary fonts are installed on the IIS server).
    Please help!

    Hi Don,
    I am able to see the image and export from the CR Designer on my machine running XP.  However, I installed the designer on our IIS server running Server 2003, and the image does not show in the designer preview on that machine.
    I found another forum thread that you are involved in (1902383) that seems to be dealing with this exact issue, and it looks like there may not be a resolution.
    I am going to try a different route - instead of pulling in the SQL Image field directly, I am going to write it out to a temporary file and pull it in by altering the graphic location of the picture object in the report.
    I'll let you know how that works.
    Pete

  • Problem Displaying image from blob

    Hi all,
    I m using,
    Database : 10g Rel 2
    Frontend : DevSuite 10g
    OS : WinXp
    Browser : IE 6
    Problem : In my forms i m displaying images from blob column but some of the images are not displayed. I have tried with all image formats available in combination with all available display quality but no luck. What could be the reason for it and how do i solve it?
    Can anyone help me plz?
    Thnx in advance.
    Imtiaz

    Hello,
    It is very difficult for us to "guess" what images you can read and what others you cannot.
    Maybe you could provide more information on images that are not displayed ?
    What is their native format ?
    Francois

  • How to load images from BLOB to javascript?

    hi, Guys:
    I need to load thumbnail images from BLOB to multiple markers' infowindow in Google map . I have implemented Google map in APEX. I load the data suchas text for every marker's infowindow from Oracle database table with PL/JSON, and infowindow works fine. Could anyone give me a suggestion or example so I know how to load images to javascript?
    Thanks a lot.
    Database: Oracle 11g R2
    APEX: APEX 4.1
    Thanks.
    Sam

    lxiscas wrote:
    hi, VC:
    Thanks for your kind reply. I need to render these images out of APEX session, actually in javascript that is related to Google map markers' infowindow.
    I checked the documents of APEX_UTIL.GET_BLOB_FILE_SRC, but my impression is I need to use it in APEX instead of javascript if my understanding is correct. I already implemented a procedure with PL/SQL to load images from a BLOB column in Oracle database. But the problem is, how can I pass it to javascript code out of APEX to javascript (I could pass text or number from APEX to javascript with PL/JSON though,But I assume that still google map will be within a valid apex session? if so you should be able to use the above api.
    Basically what this api does is generates a kind of url to each blob in the database, not sure how google api's deal with this though. Why don't you give it a try?
    The other option is to make your pl/sql procedure public and then you can generate the json to include the images urls such as:
         "employees" : [{
                   "firstName" : "John",
                   "lastName" : "Doe",
                   "imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
                   "firstName" : "Anna",
                   "lastName" : "Smith"
                   "imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
                   "firstName" : "Peter",
                   "lastName" : "Jones"
                   "imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
    }And then you can use this new attribute to populate the images in javascript using standard img tag
    See this tutorial http://docs.oracle.com/cd/E14373_01/appdev.32/e13363/up_dn_files.htm
    I did not find any method in PL/JSON to pass image object)? So far I only found example to load images from local files to javascript.Hmm..I don't think you should load image objects.
    Vikram

  • Image from BLOB now showed when page cache set

    Hello,
    I have a page that display images from BLOB,
    After setting page cache to 1hour, page load faster but images not showed.
    Please help me on this.
    Thank you.

    Hi Halit,
    For me i dont thing, this problem occurred. As i checked by setting the page cache to 1 hour. After that images loaded normally as usual.
    I tried with my mozilla browser. In which browser you tried, may be your browser fault.
    Kindly check it.
    Brgds,
    Mini
    Mark Answers Promptly

  • Inserting Image into BLOB field from URL

    Is it possible to insert an image into a BLOB field from a URL? I don't have access to the filesystem on the server and I have a page that uses PL/PDF to generate dynamic PDF files from data I pull from the database. I would like to include my companies official header with logo on the top of the PDFs I generate and need to somehow get the image which I currently have uploaded to the images section in Application Express and can access from the "Shared Components => Images" section of the Application Builder. I just want to be able to either query whatever table holds those images or copy the image I need to a blob field in one of my tables so I can use it in my PDF document.
    The other alternative (which is what I first mentioned above) would be to try and perform an insert into the BLOB field in my table but the location of the image file would be like "http://www.myportal.com:7777/pls/htmldb/wwv_flow_file_mgr.get_file?p_security_group_id=1234567&p_flow_id=111&p_fname=myimage.jpg".
    Is this possible? If not, what can I do?
    Thanks in advance.

    The reason why I am asking this question in this forum is two-fold:
    1. I am using Application Express (AE).
    2. Since I am using AE all images that I upload to my workspace are stored in a table in a database and not as an actual file in a directory structure like in Windows etc. This being the case, I can't ever reference any of the files that I upload to my workspace in order to insert them into my BLOB field unless I know their physical location on disk (which of course does not exist b/c they are stored in the AE database somewhere). If I knew AE's database and table structure I could do a "select into ..." from whatever table stores my uploaded images and save those images to my own custom table in my BLOB field.

  • How to display image in blob field in ResultSet in SiteStudio?

    I am running Site Studio 10gR4. For a custom page, I created a component that basically runs a query. The structure of the underlying data is a combination of Varchar2, Date and a single BLOB field. The blob field either contains a simple jpeg image, or nothing.
    In my Page where I am looping through the data, how do I display the blob as an image?
    Currently the code looks like this:
         <!--$loop SQLRoutes-->
              <tr>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 0))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 1))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 2))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 3))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 4))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 5))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))--></td>
              </tr>
         <!--$endloop-->Field 1 is a blob and fields 5 and 6 are dates.
    So really two questions:
    1. How do I display field1 as an image?
    Example:
    <!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 1))-->doesn't do it. Is there a different function then getValue() that I should be using to get the blob contents?
    2. I want to compare the date fields to todays date, and either change the color or conditionally display the fields. I could do this with basic taglibs from jsp. How do I do this with IDocScript?
    Example:
    <!--$if getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6)) > dateCurrent-->
      <span class="red"><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))--></span>
    <!--$endif-->Thanks, Ken

    I actually don't know the answer to #1. If I were to guess, there's nothing out-of-the-box to handle blobs, so your best option is to write your own idoc function. Take a look at the How To component if you don't know how.
    For #2, you almost have it right. Insert bold:
    &lt;!--$if <b>parseDate(formatDate(</b>getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))<b>)) gt</b> dateCurrent<b>()</b>--&gt;
    &lt;span class="red"&gt;<!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))-->&lt;/span&gt;
    <!--$endif-->

  • Low-quality iPhone images from Aperture 2.0

    Hi. I'm trying Aperture 2.0, and I configured iTunes to sync some photos from Aperture with my iPhone.
    The problem is, the photos on my iPhone from Aperture are noticeably lower in quality than those synced from iPhoto. The images are blurry and look like low-quality JPG's.
    In Aperture's preferences, I set the preview quality slider to maximum and set the limit preview size menu to "don't limit". Still, the images on my iPhone are of poor quality.
    Is there anything I can do to make the images Aperture exports to my iPhone look as good as those synced from iPhoto?
    Thanks!

    It seems that Ap2 syncs the previews to the iPhone... you have to clear the previous cached previews before it will load higher quality previews... anyhow, here is what I did... and photos look better on my iphone (not feeling motivated enough to verify if it is the same quality as iphoto sync)...
    1.) change Ap2 prefs for "limit preview size" to "don't limit"...
    2.) select all the photos in the album(s) you are want to sync, right click (ctrl click), and select delete previews...
    3.) sync your iphone again...
    if that doesn't work directly, you might need to uncheck sync photos to delete all photos on the iphone, but the ultimate goal is to ensure refresh with the higher quality previews...
    Hope that makes sense or gets folks in the right direction... Apple really needs to put a check box in future version of itunes to sync full quality or something...

  • Report not showing my image in BLOB field

    Hi,
    I m using report 6i.
    But I just upgraded my server from Oracle 8.0 to 9i and now that I have a new table with image, I created the field to be a BLOB field.
    However, in old days, I uses LongRaw and I save my images using the following:-
    READ_IMAGE_FILE(filename, 'BMP', 'logos.logo')
    it works perfectly when I call the file outfrom my report but now, after I changed to BLOB, I use the report to open the BLOB field and stated it as image, it shows error stating that the report cannot identify the image.
    Any advice on this please?
    Thankz

    Develop a simple form including the BLOB field and set the properties of the image item accordingly.
    See help in forms 9i for details & examples.
    Use read_image_file built-in to read the image from the file to the BLOB item of this form.
    In the report, you set the properties of the BLOB field as in my previous reply. Run the report. That's all!
    In the reports developer, I don't think you can use read_image_file built in.

  • Retrieve XMLP documents directly from BLOB fields in E1; Tools Release 8.97

    Hi,
    I want to be able to retrieve XML Publisher reports (PDF, RTF, HTML) directly from the database BLOB fields in EnterpriseOne. Instead of making users manually save each report to get a soft-copy of the report, I wanted to be able to retrieve the reports from a BLOB field, create a new external file for it, and open the file with the related editor (MS Word, Adobe, IE, etc.).
    We are on Oracle 10g, and I was able to get a file populated with some BLOB data for a particular RTF file. However, when I try to open the file in MS Word, all I get is junk.
    Does anyone know if JDE stores these documents differently into BLOB fields than standard?
    Here is the code I used using PL/SQL...
    DECLARE
    xmlstr BLOB;
    warn VARCHAR2(400);
    v_file Utl_File.file_type;
    line_buf RAW(32767);
    maxbufsize BINARY_INTEGER := 32767;
    amount BINARY_INTEGER;
    offset BINARY_INTEGER;
    dir varchar2(50) := 'XMLP_DIR';
    filename varchar2(50) := 'JPARK_TEST.rtf';
    bsize NUMBER;
    BEGIN
    v_file := utl_file.fopen(dir,filename,'wb',maxbufsize);
    SELECT xorpdxpblb INTO xmlstr FROM sy812.F95631 WHERE xorpdorgud = '2115630440008e-SMNQTWZCFI-YEKRWCIOUA';
    --SELECT xdrpdubblb INTO xmlstr FROM sy812.F95630 WHERE xdrpduogud = '21080156900001-SMNQTWZCFI-ORORNYFSYJ';
    bsize := dbms_lob.getLength(xmlstr);
    dbms_output.put_line(bsize);
    amount := maxbufsize;
    offset := 1;
    WHILE (offset<bsize) LOOP
    DBMS_LOB.read(xmlstr,amount,offset,line_buf);
    utl_file.put_raw(v_file,line_buf, TRUE);
    offset := offset+amount;
    --utl_file.fflush(v_file);
    --Dbms_Output.put_line(offset);
    END LOOP;
    utl_file.fclose(v_file);
    EXCEPTION
    WHEN OTHERS THEN
    UTL_FILE.FCLOSE_ALL;
    DBMS_OUTPUT.PUT_LINE('WHEN OTHERS');
    dbms_output.put_line(substr(sqlerrm,1,254));
    END;

    the database and blob fields are identical. In the 11i (eBusiness suite) we would store this information in fnd_lobs.
    Ike Wiggins
    http://bipublisher.blogspot.com

  • How can i store image into blob field in oracle express ??

    Hi
    am using oracle express *(2.1)* , i am devloping a small system , we have to store an image in blob filed in a table, we have to create a form which allow the user to store the image in the table and to generate a report contains the image
    any note's please
    tahnk's in advance
    sam
    Edited by: user485341 on Dec 22, 2008 1:28 AM

    hi Andy
    this is the code for download
    create or replace PROCEDURE download_my_file(p_file in number) AS
    v_mime VARCHAR2(48);
    v_length NUMBER;
    v_file_name VARCHAR2(2000);
    Lob_loc BLOB;
    BEGIN
    SELECT MIME_TYPE, BLOB_CONTENT, FILE_NAME,DBMS_LOB.GETLENGTH(BLOB_CONTENT)
    INTO v_mime,lob_loc,v_file_name,v_length
    FROM A_IMAGES
    WHERE IMAGE_ID = p_file;
    owa_util.mime_header( nvl(v_mime,'application/octet'),FALSE );
    -- set the size so the browser knows how much to download
    htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    htp.p('Content-Disposition: attachment;
    filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1)
    ,chr(10),null),chr(13),null)|| '"');
    -- close the headers
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( Lob_loc );
    end download_my_file;
    thank's

  • Creating Packages from BLOB field contents, line wrap problems

    Good afternoon,
    we use an in-house developed database-driven update system to update both our databases and filesystems, the system itself performs really well but there is still one problem I can't fix without some expert help:
    the code of to-be-updated Oracle packages is stored inside of a BLOB field, the BLOB field will contain both the package specification and package body and needs to be split into two parts to first execute the spec and then to execute the package body (I tried to execute both in a single step but this didn't work). This works for packages with less than 32767 characters and also works in some other cases but I found one case where the executed code contains an extra line wrap right in the middle of a word.
    To make it more clear (I hope it's comprehensible), imagine the following database content:
    CREATE OR REPLACE Package
    MyPack
    AS
    [... a lot procedure headers ...]
    END MyPack;
    CREATE OR REPLACE
    Package Body MyPack AS
    [... a lot more procedures ...]
    PROCEDURE myTest (intID OUT integer)
    AS
    BEGIN
      SELECT count (*) into intID FROM MyTa[--this is where the dbms_lob.substr() ends --]ble;
    END;
    END MyPack;My code searches for the second occurrence of the "Create or replace package", splits the code into spec and body, executes the specification and keeps on adding the rest of the code to a VARCHAR2A variable called "storedCode" from the BLOB. Now in the above example, after the specification has been removed from the string, the remaining characters (ending with the "MyTa" string) are added to the varchar2a variable, the next line is fetched from the BLOB via "dbms_lob.substr()" and added as long as dbms_lob.substr() does not return a NULL value (end of BLOB). When the code is executed after all has been fetched, the generated Package Body will contain an extra line wrap right in the middle of the "MyTable" word compiling the package invalid.
    This is the procedure code I use (definitely improvable, I'm better in MSSQL and MySQL dialects ...) to load, parse and execute the BLOB content:
       -- to run package code
      procedure runPackageCode (stepRef integer)
      AS
        numLines integer default 1;
        pos     integer default 1;
        storedCode    LOG_CHANGEDOBJECT.STOREDOBJECT%type;
        objectCursor  integer;
        lSqlOut     integer;
        sqlCommand  dbms_sql.varchar2a;
        emptyCommand dbms_sql.varchar2a;
        pIsError integer := 0;
        pErrorMsg varchar2(200) := '';
        updateRef integer := 0;
        currentUpdate integer := 0;
        schemaReference varchar2(20);
        -- required to do string cutting
        strLine varchar2(32767);
        strLeftFromSlash varchar2(32767);
        strRemaining varchar2(32767);
        intDelimiterPos integer := 0;
      begin
        -- retrieve update ID
        SELECT log_update_ref INTO currentUpdate FROM link_update_with_taskstep WHERE log_taskstep_ref = stepRef;
         begin
            select storedobject, change_area
            into storedCode, schemaReference
            from vw_storedobjects
            where step_id = stepRef;
         exception
          when no_data_found then
            pIsError := 1;
            pErrorMsg := 'Invalid SQL ID ' || stepRef;
            pkg_generic.LogError(updateRef, 'LocalUpdater', stepRef, 'Run package code failed: ' || pErrorMsg);
         end;
          if pIsError = 0 then     
            begin
              -- change schema
              execute immediate 'alter session set current_schema = ' || schemaReference;         
              objectCursor := dbms_sql.open_cursor;   
              loop
                strLine := UTL_RAW.CAST_TO_VARCHAR2(dbms_lob.substr(storedCode, 32767, pos));
                intDelimiterPos := regexp_instr(strLine, '\s*Create\s*or\s*Replace\s*Package', 2, 1, 0, 'i');
                while intDelimiterPos > 0
                loop
                  -- '/' found, execute currently stored statement
                  strLeftFromSlash := substr(strLine, 1, intDelimiterPos-1);
                  strLine := substr(strLine, intDelimiterPos);
                  -- execute the extracted part without any '/' in it
                  sqlCommand(numLines) := regexp_replace(strLeftFromSlash, '(^|\s+)/(\s+|$)', '', 1, 0, 'm');
                  if (sqlCommand(numLines) is not null) then
                    objectCursor := dbms_sql.open_cursor;   
                    dbms_sql.parse(objectCursor, sqlCommand, 1, numLines, true, dbms_sql.native);
                    lSqlOut := dbms_sql.execute(objectCursor);
                    dbms_sql.close_cursor(objectCursor);
                  end if;
                  -- reset sqlCommand
                  sqlCommand := emptyCommand;
                  -- reset line counter and store remaining string
                  numLines := 1;
                  -- check for further '/'s           
                  intDelimiterPos := regexp_instr(strLine, '\s*Create\s*or\s*Replace\s*Package', 2, 1, 0, 'i');
                end loop;
                -- add the remaining strLine to the sqlCommand
                strLine := regexp_replace(strLine, '(^|\s+)/(\s+|$)', '', 1, 0, 'm');
       --> I assume this line breaks the code, lpad()'ing the content to move it to the end of a varchar2a line didn't help
                sqlCommand(numLines) := strLine;
                exit when sqlCommand(numLines) is null;
                pos := pos+32767;
                numLines := numLines+1;
              end loop;
              objectCursor := dbms_sql.open_cursor;   
              dbms_sql.parse(objectCursor, sqlCommand, 1, numLines, true, dbms_sql.native);   
              lSqlOut := dbms_sql.execute(objectCursor);
              dbms_sql.close_cursor(objectCursor);
              commit;
              -- reset schema
              execute immediate 'alter session set current_schema = UPDATE_DB';
              -- set state to installed
              pkg_update.setstepstate(stepRef, 'Installed');
        exception
        when others then
              -- reset schema
              execute immediate 'alter session set current_schema = UPDATE_DB';
              -- set state to installFailed
              pkg_update.setstepstate(stepRef, 'InstallFailed');
              pkg_generic.LogError(updateRef, 'Database', stepRef, 'Run package code failed: ' || sqlerrm);
        end;
        end if;
      END;    Thanks if you kept on reading so far, I would really appreciate any feedback!
    Regards, Sascha

    Welcome to the forum!
    Whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
    Thanks for providing an easy-to-understand problem statement and for using code tags.
    >
    the code of to-be-updated Oracle packages is stored inside of a BLOB field
    >
    This should be stored in a CLOB since it is character data. Why are you using BLOB?
    >
    the BLOB field will contain both the package specification and package body and needs to be split into two parts to first execute the spec and then to execute the package body
    >
    Good, clear problem statement. So why doesn't your code do just what you said it should do: 1) split the code into two parts, 2) execute the spec and 3) execute the body.
    Instead of writing code that does these three relatively simple steps your code tries to combine splitting and executing and mushes/mashes it all together. The result, as you found, is code that is hard to understand, hard to debug, doesn't work and doesn't report on what it is doing.
    Code like this doesn't have a performance issue so the code should implement the simple step-by-step process that you so elegantly stated in your problem description:
    1. split the code into two parts
    2. execute the spec
    3. execute the body
    My advice is to refactor your code to perform the above steps in the proper order and to add proper exception handling and reporting for each step. Then when a step isn't working you will know exactly where and what the problem is.
    Here are my recommendations.
    1. Add two CLOB variables - one will hold the spec, the second will hold the body
    2. Add a comment (you have some good ones in the code now) for every step no matter how trivial it may be
    3. Add exception/error handling to EVERY STEP
    Your code for the first step has a comment but no exception handling. What should happen if you don't get any data? Why aren't you validating the data you get? Dynamic SQL using table-driven data is great, I love it, but you MUST validate that the data you get is what you expect to get.
        -- retrieve update ID
        SELECT log_update_ref INTO currentUpdate FROM link_update_with_taskstep WHERE log_taskstep_ref = stepRef;Recommended
        -- step 1 - retrieve update ID - This is the id that determines BLAH, BLAH, BLAH - add appropriate to tell a new developer what this ID is and what it means.
        BEGIN
            SELECT log_update_ref INTO currentUpdate FROM link_update_with_taskstep WHERE log_taskstep_ref = stepRef;
        EXCEPTION
            WHEN ??? THEN -- what should happen if step 1 fails? Do it here - don't default to an exception handler that is several pages away.
        END;Your code
         begin
            select storedobject, change_area
            into storedCode, schemaReference
            from vw_storedobjects
            where step_id = stepRef;
         exception
          when no_data_found then
            pIsError := 1;
            pErrorMsg := 'Invalid SQL ID ' || stepRef;
            pkg_generic.LogError(updateRef, 'LocalUpdater', stepRef, 'Run package code failed: ' || pErrorMsg);
         end;
    Good - except there is no comment that says what this does - I assume that the query above and this block are the 'retrieve update ID ' step?
    You log an error message and set the error flag to '1'. But since you don't want to continue why aren't you exiting the procedure and returning right here?
          if pIsError = 0 then     
            beginSo now you check the error flag and do several pages of code if there were no errors.
    I don't like that 'inverted' logic.
    If you don't want to continue then STOP right now! Don't make a developer scan through pages and pages of code to find out you really aren't doing anything else if there was an error.
    Either put a RETURN statement in the exception handler above or change your code to
          if pIsError = 1 then     
            RETURN;
          end if;Now the rest of the code doesn' t have to be indented; you will never get there if there is an error. Check for errors after every step and exit right then as appropriate.
              -- change schema
              execute immediate 'alter session set current_schema = ' || schemaReference;         
              objectCursor := dbms_sql.open_cursor;   
              loop
                strLine := UTL_RAW.CAST_TO_VARCHAR2(dbms_lob.substr(storedCode, 32767, pos));
                intDelimiterPos := regexp_instr(strLine, '\s*Create\s*or\s*Replace\s*Package', 2, 1, 0, 'i');
                while intDelimiterPos > 0
                loopThis code mixes all of the steps together into one giant mess. You open a cursor, try to split the BLOB into spec and body and try to parse and execute both all within a double nested loop.
    Even if that works correctly another developer will have a hard time understanding what the code is doing and fixing it if it goes wrong. And it will go wrong if you let me test if for you because I will put garbage into the BLOB for the spec, body or both to make sure it breaks and to see how your code handles it.
    I suggest you rewrite this double nested loop to perform the three steps separately.
    1. split the code into two parts
    a. put the spec into one new CLOB variable and the body into the other.
    b. use DBMS_OUTPUT (or a work table) to output the spec and body so you can see what the code is and make sure the 'split' process worked properly. You probably created that BLOB by manually concatenating the SPEC and BODY to begin with so now create a SPLIT process to split them again and give them back to you. This is such a fundamental component that I suggest creating a new SPLIT_MY_BLOB procedure. This procedure would take a BLOB and return two CLOBS as OUT parameters: one CLOB is the spec and one is the body. Then you can reuse this 'split' procedure in other code or more complex versions of code. Modular programming is the key.
    2. execute the spec - Now have a step that executes the spec and does something appropriate if the step succeeds or if it fails. I mean, do you really want to do execute the body if the spec execution fails? What do you want to do? Should you delete the body and spec? If you don't you might wind up with an INVALID body based on old code and an INVALID spec based on the new code you were trying to use. How will anyone, including you, know that the spec and body in the ALL_SOURCE view is really two different versions of things?
    This suggests that for your use case you may want to consider DROPPING the entire package, spec and body, before trying to recreate them both. At least if the package is totally missing anyone will know that the entire thing needs to be put back. Ahhhh - but to do that you need to know the package name so you can drop it. Than may require adding another step to get the package name from your data-driven table and adding a DROP PACKAGE step.
    3. execute the body - This step executes the body. Hmmmm - we have two nearly identical steps. So why don't you create a new function/procedure that takes a CLOB as input, uses dynamic sql to execute it and returns a result code. That would be useful. Then you could execute ANY sql stored in a CLOB and have a generic function that you can use for other things.
    Right now you are using the VARCHAR2 table version of DBMS_SQL.PARSE but you would change this to use the CLOB version.
    The end result of this refactoring is a main function/procedure that acts as the CONTROL - it decides what to do and what data (BLOB) to do it with. But it doesn't actually do ANY of the work. It just controls what is done.
    And you have a couple of generic, reuseable functions that actually do the work. One knows how to split a CLOB into spec and body. The other knows how to use dynamic SQL to execute a CLOB.
    Now you have a modular architecture that is easy to understand, easy to code and easy to test.

  • Retreving Image from Blob in forms 6

    I am using forms 6 and oracle 9i.i have an image item and on when_button_press trigger i insert an image into the image_item by calling the read_image_file function and then save that image into the database.it gives me a message that 1 transactoion applied and saved. now i want to to retrived that image from database into form.how should i do it.also how will i know whether my image has been saved or not.when i tried to execute query i got message query caused no records to be retreived.
    my table name is test_images and i have one column image(blob)

    your test_image table better to have another primary key item like file_id number with table trigger to sequence generating its value for IF INSERTING event, or it will have no handle to get the image back.

  • Poor quality HD image

    We've just cancelled our BT TV package as the equipment is dire in both terms of picture quality and product reliability.
    Issues, such as intermittent crashing box, motion blurr, digital artefacts, poor frame rates and generally just dreadfully substandard performance.
    My former Technisat Freesat satellite reciever gave us perfect performance until the trees in the wood behind us blocked the signal totally. Else I would never have parted with it.
    We will carry on with the Netflix account and revert to running that stream through my Sony Playstation as the picture is much clearer through that as is BBC iPlayer.
    All in all a great disappointment.
    Solved!
    Go to Solution.

    I made it clear that the reciever is poor quality.
    There is no fault with it per se, except poor design.
    Much of the limitations with digital signal processing are made worse through this particular design. The motion blur and various other processing artefacts make the image intolerable to watch on this device.
    My background is in broadcast and maybe I can see things the standard viewer 'can't see'. This is my shortcoming and not anyone else.
    I have high expectations and will be continually disappointed unless the equipment is up to the job, so to speak.

Maybe you are looking for