Lob display

8.1.7 xsu documentation provides the example below. Does anyone
know how to display a clob based on this example:
declare
queryCtx DBMS_XMLquery.ctxType;
result CLOB;
Buffer RAW(1024);
Amount BINARY_INTEGER := 1024;
Position INTEGER := 1;
begin
-- set up the query context...!
queryCtx := DBMS_XMLQuery.newContext('select * from dual');
-- get the result..!
result := DBMS_XMLQuery.getXML(queryCtx);
-- Now you can use the result to put it in tables/send as
messages..
printClobOut(result);
DBMS_XMLQuery.closeContext(queryCtx); -- you must close the
query handle..
end;
/

Frank,
The documentation included the printCLOBOut code, as well.
See
http://otn.oracle.com/docs/tech/xml/oracle_xsu/doc_library/adx04x
su.html#1005334
Here is what you will find:
>>
printClobOut(result IN OUT NOCOPY CLOB)
xmlstr varchar2(32767);
line varchar2(2000);
begin
xmlstr := dbms_lob.SUBSTR(result,32767);
loop
exit when xmlstr is null;
line := substr(xmlstr,1,instr(xmlstr,chr(10))-1);
dbms_output.put_line('| '||line);
xmlstr := substr(xmlstr,instr(xmlstr,chr(10))+1);
end loop;
end;
<<
Since I am a total novice PL/SQL coder, I just added the xmlstr
and line variable to the "declare" section of the code that does
the query. And, snipped the code from printCLOBOut and pasted
it after the getXML call.
The final example follows. I was able to execute this in
SQL*Plus, just fine. The only problem I ran into was the output
buffer was not large enough to handle the amount of data in the
table I queried. You need to "set serveroutput on", in order to
see the output.
1. Run SQL*Plus
2. Connect to your database.
3. Substite the appropriate TABLE name for 'ATCOMMON.US_STATE'.
4. set serveroutput on
5. Paste in the code
6. View the results.
It is a good idea to use a table with just a few rows/columns.
Otherwise, modify the Select to specify just a few columns and
add a WHERE clause to limit the number of rows.
Mike Farnham
University of Wisconsin - Madison
[email protected]
>>
declare
queryCtx DBMS_XMLquery.ctxType;
result CLOB;
xmlstr varchar2(32767);
line varchar2(1024);
begin
queryCtx := DBMS_XMLQuery.newContext('select * from
ATCOMMON.US_STATE');
result := DBMS_XMLQuery.getXML(queryCtx);
xmlstr := dbms_lob.SUBSTR(result,32767);
loop
exit when xmlstr is null;
line := substr(xmlstr,1,instr(xmlstr,chr(10))-1);
dbms_output.put_line('| '||line);
xmlstr := substr(xmlstr,instr(xmlstr,chr(10))+1);
end loop;
DBMS_XMLQuery.closeContext(queryCtx);
end;
<<

Similar Messages

  • Implementing archive functionality

    Hi all ,
    I want to implement archive functionality.
    I am using appfuse and maven.(spring framework)
    In my aplication when user logs in he is provided with list of records from one table.
    He should be able to archive as many recrds as he want.
    I am not getting how to implement this functionality.
    Code of jsp which shows al records is
    <head>
    <title><fmt:message key="engagementformList.title"/></title>
    <meta name="heading" content="<fmt:message key='engagementformList.heading'/>"/>
    <meta name="menu" content="EngagementformMenu"/>
    </head>
    <c:set var="buttons">
    <input type="button" style="margin-right: 5px"
    onclick="location.href='<c:url value="/engagementformform.html"/>'"
    value="<fmt:message key="button.add"/>"/>
    <input type="button" onclick="location.href='<c:url value="/mainMenu.html"/>'"
    value="<fmt:message key="button.exit"/>"/>
    </c:set>
    <c:out value="${buttons}" escapeXml="false"/>
    <form>
    <display:table name="engagementformList" class="table" requestURI="" id="engagementformList" export="true" pagesize="25">
    <display:column property="id" sortable="true" href="engagementformform.html" media="html"
    paramId="id" paramProperty="id" titleKey="engagementform.id"/>
    <display:column property="id" media="csv excel xml pdf" titleKey="engagementform.id"/>
    <display:column sortProperty="dateLastMod" sortable="true" titleKey="engagementform.dateLastMod">
    <fmt:formatDate value="${engagementformList.dateLastMod}" pattern="dd/MM/yyyy"/>
    </display:column>
    <display:column sortProperty="dateRcvd" sortable="true" titleKey="engagementform.dateRcvd">
    <fmt:formatDate value="${engagementformList.dateRcvd}" pattern="dd/MM/yyyy"/>
    </display:column>
    <display:column property="title" sortable="true" titleKey="engagementform.title"/>
    <display:column property="requestorsName" sortable="true" titleKey="engagementform.requestorsName"/>
    <display:column property="requestorsExtensionNo" sortable="true" titleKey="engagementform.requestorsExtensionNo"/>
         <display:column property="requestorsEmailId" sortable="true" titleKey="engagementform.requestorsEmailId"/>
    <display:column property="LOB" sortable="true" titleKey="engagementform.LOB"/>
    <display:column property="ITSolutionLeadsName" sortable="true" titleKey="engagementform.ITSolutionLeadsName"/>
    <display:column property="ITSolutionLeadsExtensionNo" sortable="true" titleKey="engagementform.ITSolutionLeadsExtensionNo"/>
    <display:column property="ITSolutionLeadsEmailId" sortable="true" titleKey="engagementform.ITSolutionLeadsEmailId"/>
    <display:column property="solve" sortable="true" titleKey="engagementform.solve"/>
    <display:column property="solveNumber" sortable="true" titleKey="engagementform.solveNumber"/>
    <display:column property="typeofRequest" sortable="true" titleKey="engagementform.typeofRequest"/>
    <display:column property="partOfProgram" sortable="true" titleKey="engagementform.partOfProgram"/>
    <display:column property="reasonWorkRequired" sortable="true" titleKey="engagementform.reasonWorkRequired"/>
    <display:column property="descriptionOfWorkRequired" sortable="true" titleKey="engagementform.descriptionOfWorkRequired"/>
    <display:column property="impactIfChangeIsNotMade" sortable="true" titleKey="engagementform.impactIfChangeIsNotMade"/>
    <display:column property="relatedProjectProgramActivity" sortable="true" titleKey="engagementform.relatedProjectProgramActivity"/>
    <display:column property="quantifiedFinancialBenefits" sortable="true" titleKey="engagementform.quantifiedFinancialBenefits"/>
    <display:column property="otherBenefits" sortable="true" titleKey="engagementform.otherBenefits"/>
    <display:column property="funding" sortable="true" titleKey="engagementform.funding"/>
    <display:column property="priority" sortable="true" titleKey="engagementform.priority"/>
    <display:column property="priorityDate" sortable="true" titleKey="engagementform.priorityDate"/>
    <display:column property="timingIssues" sortable="true" titleKey="engagementform.timingIssues"/>
    <display:column property="alternativeSolutions" sortable="true" titleKey="engagementform.alternativeSolutions"/>
    <display:column property="status" sortable="true" titleKey="engagementform.status"/>
    <display:column property="username" sortable="true" titleKey="engagementform.username"/>
    <%-- <display:column property="archived" sortable="true" titleKey="engagementform.archived"/> --%>
    <display:column sortable="true" titleKey="engagementform.archived">
    <input type="checkbox" name="archived" value="${engagementformList.id}" >
    <c:out value="${engagementformList.id}" />
         </display:column>
    <display:setProperty name="paging.banner.item_name" value="engagementform"/>
    <display:setProperty name="paging.banner.items_name" value="engagementforms"/>
    <display:setProperty name="export.excel.filename" value="Engagementform List.xls"/>
    <display:setProperty name="export.csv.filename" value="Engagementform List.csv"/>
    <display:setProperty name="export.pdf.filename" value="Engagementform List.pdf"/>
    </display:table>
    </form>
    <c:out value="${buttons}" escapeXml="false"/>
    I ma not getting how will i collect all the reocrds that are marked for archiving in from this jsp and pass it to controller for archiving.
    Can anybody have an idea about this or implemented this before.
    Thanks in advance.

    yes,but i am notegetting how will i collect all the records for which checkbox has checked im this jsp and how to pass that list of records from jsp to controller. :(

  • Storing and displaying LOB - pdf, images

    Hi,
    I am using Oracel 10g on Linux.
    I need to store pdfs and images and display them using HTMLDB reports and Discoverer reports. the LOBs size vary from 30KB to 1700KB.
    Which will be the best way to store these objects. since the sizes are not that big, i was thinking of storing them directly in the database tables instead of storing them externally.
    and storing internally in the database, will it be better for a quick retrieval and display of the LOB in the reports.
    Can somone guide me and maybe link me to some documents for storing LOB and displaying using HTMLDB and Discoverer.
    Thanks,
    Philip.

    Whether you store the documents in the database or not is totally dependent on your requirements (backup, security, etc). As for performance, you may need to test that for yourself once you have it configured.
    You may want to walk through this How to Upload and Download Files in an Application. It provides detailed instructions for facilitating what you are looking for in Application Express (formerly HTMLDB).

  • Query Result pane - disabling tooltip display of LOB data

    In the query result pane of SQL Developer, if a column is too long for the display (typically, in my case, for a CLOB column) and you hover the mouse over the column data, a tooltip showing the full value appears.
    For an example, do "select sql_fulltext from v$sql where rownum < 3" and hover the mouse over one of the values in the SQL_FULLTEXT column.
    In our application we typically query a table with a large CLOB column, and the tooltip fills the whole screen. This is a pain if you just leave your mouse on the screen somewhere over a CLOB column while typing :-( I've looked for a way to switch off this tooltip, but haven't managed to find one. Can anyone point me at a way of doing so? Unfortunately, I'm running SQL Developer 2.1.1, but even a response along the lines of "you can only do this in 3.0 and later, and this is how" would be useful, as it might help me argue for an upgrade.
    Thanks,
    Paul

    Hi Paul,
    Actually versions 3.0 and 3.1 have a very nice UI (Tools | Preferences | Mouseover Popups) to control this sort of thing, but unfortunately the settings seem only applicable to the debugger.
    You might consider making a feature request for this on the SQL Developer Exchange.
    Regards,
    Gary
    SQL Developer Team

  • R3load export of  table REPOSRC with lob col - error ora-1555 and ora-22924

    Hello,
    i have tried to export data from our production system for system copy and then upgrade test. while i export the R3load job has reported error in table REPOSRC, which has lob column DATA. i have apsted below the conversation in which i have requested SAP to help and they said it comes under consulting support. this problem is in 2 rows of the table.
    but i would like to know if i delete these 2 rows and then copy from our development system to production system at oracle level, will there be any problem with upgrade or operation of these prorgams and will it have any license complications if i do it.
    Regards
    Ramakrishna Reddy
    __________________________ SAP SUPPORT COnveration_____________________________________________________
    Hello,
    we have are performing Data Export for System copy of our Production
    system, during the export, R3load Job gave error as
    R3LOAD Log----
    Compiled Aug 16 2008 04:47:59
    /sapmnt/DB1/exe/R3load -datacodepage 1100 -
    e /dataexport/syscopy/SAPSSEXC.cmd -l /dataexport/syscopy/SAPSSEXC.log -stop_on_error
    (DB) INFO: connected to DB
    (DB) INFO: DbSlControl(DBSL_CMD_NLS_CHARACTERSET_GET): WE8DEC
    (DB) INFO: Export without hintfile
    (NT) Error: TPRI_PAR: normal NameTab from 20090828184449 younger than
    alternate NameTab from 20030211191957!
    (SYSLOG) INFO: k CQF :
    TPRI_PAR&20030211191957&20090828184449& rscpgdio 47
    (CNV) WARNING: conversion from 8600 to 1100 not possible
    (GSI) INFO: dbname = "DB120050205010209
    (GSI) INFO: vname = "ORACLE "
    (GSI) INFO: hostname
    = "dbttsap "
    (GSI) INFO: sysname = "AIX"
    (GSI) INFO: nodename = "dbttsap"
    (GSI) INFO: release = "2"
    (GSI) INFO: version = "5"
    (GSI) INFO: machine = "00C8793E4C00"
    (GSI) INFO: instno = "0020111547"
    (DBC) Info: No commits during lob export
    DbSl Trace: OCI-call 'OCILobRead' failed: rc = 1555
    DbSl Trace: ORA-1555 occurred when reading from a LOB
    (EXP) ERROR: DbSlLobGetPiece failed
    rc = 99, table "REPOSRC"
    (SQL error 1555)
    error message returned by DbSl:
    ORA-01555: snapshot too old: rollback segment number with name "" too
    small
    ORA-22924: snapshot too old
    (DB) INFO: disconnected from DB
    /sapmnt/DB1/exe/R3load: job finished with 1 error(s)
    /sapmnt/DB1/exe/R3load: END OF LOG: 20100816104734
    END of R3LOAD Log----
    then as per the note 500340, i have chnaged the pctversion of table
    REPOSRC of lob column DATA to 30, but i get the error still,
    i have added more space to PSAPUNDO and PSAPTEMP also, still the same
    error.
    the i have run the export as
    exp SAPDB1/sap file=REPOSRC.dmp log=REPOSRC.log tables=REPOSRC
    exp log----
    dbttsap:oradb1 5> exp SAPDB1/sap file=REPOSRC.dmp log=REPOSRC.log
    tables=REPOSRC
    Export: Release 9.2.0.8.0 - Production on Mon Aug 16 13:40:27 2010
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit
    Production
    With the Partitioning option
    JServer Release 9.2.0.8.0 - Production
    Export done in WE8DEC character set and UTF8 NCHAR character set
    About to export specified tables via Conventional Path ...
    . . exporting table REPOSRC
    EXP-00056: ORACLE error 1555 encountered
    ORA-01555: snapshot too old: rollback segment number with name "" too
    small
    ORA-22924: snapshot too old
    Export terminated successfully with warnings.
    SQL> select table_name, segment_name, cache, nvl(to_char
    (pctversion),'NULL') pctversion, nvl(to_char(retention),'NULL')
    retention from dba_lobs where
    table_name = 'REPOSRC';
    TABLE_NAME | SEGMENT_NAME |CACHE | PCTVERSION | RETENTION
    REPOSRC SYS_LOB0000014507C00034$$ NO 30 21600
    please help to solve this problem.
    Regards
    Ramakrishna Reddy
    Dear customer,
    Thank you very much for contacting us at SAP global support.
    Regarding your issue would you please attach your ORACLE alert log and
    trace file to this message?
    Thanks and regards.
    Hello,
    Thanks for helping,
    i attached the alert log file. i have gone through is, but i could
    not find the corresponding Ora-01555 for table REPOSRC.
    Regards
    Ramakrishna Reddy
    +66 85835-4272
    Dear customer,
    I have found some previous issues with the similar symptom as your
    system. I think this symptom is described in note 983230.
    As you can see this symptom is mainly caused by ORACLE bug 5212539 and
    it should be fixed at 9.2.0.8 which is just your version. But although
    5212539 is implemented, only the occurrence of new corruptions will be
    avoided, the already existing ones will stay in the system regardless of the patch.
    The reason why metalink 452341.1 was created is bug 5212539, since this
    is the most common software caused lob corruption in recent times.
    Basically any system that was running without a patch for bug 5212539 at some time in the past could be potentially affected by the problem.
    In order to be sure about bug 5212539 can you please verify whether the
    affected lob really is a NOCACHE lob? You can do this as described in
    mentioned note #983230. If yes, then there are basically only two
    options left:
    -> You apply a backup to the system that does not contain these
    corruptions.
    -> In case a good backup is not available, it would be possible to
    rebuild the table including the lob segment with possible data loss . Since this is beyond the scope of support, this would have to be
    done via remote consulting.
    Any further question, please contact us freely.
    Thanks and regards.
    Hello,
    Thanks for the Help and support,
    i have gone through  the note 983230 and metalink 452341.1.
    and i have ran the script and found that there are 2 rows corrupted in
    the table REPOSRC. these rows belong to Standard SAP programs
    MABADRFENTRIES & SAPFGARC.
    and to reconfirm i have tried to display them in our development system
    and production system. the development systems shows the src code in
    Se38 but in production system it goes to short dump DBIF_REPO_SQL_ERROR.
    so is it possible to delete these 2 rows and update ourselves from our
    development system at oracle level. will it have any impact on SAP
    operation or upgrade in future.
    Regards
    Ramakrishna Reddy

    Hello, we have solved the problem.
    To help someone with the same error, what we have done is:
    1.- wait until all the processes has finished and the export is stopped.
    2.- startup SAP
    3.- SE14 and look up the tables. Crete the tables in the database.
    4.- stop SAP
    5.- Retry the export (if you did all the steps with sapinst running but the dialogue window in the screen) or begin the sapinst again with the option: "continue with the old options".
    Regards to all.

  • Options to control display performance of CLOBs, etc. in Query Result view?

    Whenever I attempt to query a table that contains LOBs (e.g. a CLOB or XMLTYPE), the lack of performance pretty much makes the "Query Result" view (from F9) unusable. Any time I attempt to scroll the results, SQL developer apparently continues to query the database for the additional characters to populate the view.
    Resizing the columns containing the LOB to only a few characters almost solves the issue. Unfortunately, the size of the columns showing the LOBs apparently attempt to resize to the length of the LOB, making the column several pages long - and the same performance issue prevents resizing it smaller.
    Ideally, there would be some way to resize a column to a given or even a predefined and small size, without having to drag the resize handle the entire width of the desired resize amount. Alternatively, there could be a user preference to never set default column widths above a given number of pixels or characters. Another option would be a user preference to disable the in-line display of LOB contents, displaying only and requiring a click on the "..." (or pencil icon) button to open the "View Value" dialog. Ideally, all 3 of these options could be implemented.
    One crude work-around I'm using for now is to exclude the LOB columns from the results, requiring me to make secondary queries to see the LOB contents when necessary, and doesn't allow for scrolling through and viewing the LOB contents at all. Another work-around is to run the query as a script (F5) instead of a query (F9), and view the results in the "Script Output" view instead.
    I'm currently using SQL Developer 2.1.0.63, but experienced this same issue with all previous versions, including 1.5.5.
    Thanks!

    I agree.
    When I requested to auto-width the columns, I said to build in a maximum, but apparently they didn't.
    I suggest you log 2 feature requests on the SQL Developer Exchange; 1 for the maximum width, 1 for the CLOB contents/performance. Like this others can vote too and add weight for future implementation (I will).
    Have fun,
    K.

  • Urgent ! Code for Displaying Image from Oracle BLOB image on VB Form

    Hi Plz any one have any work to showing a Picuture on Visual Basic Form, i Save the Picure in table and its column type is BLOB where i save picture, now i want to show it on VB form. if anybody knows plz tell me. and if image not found then how can i handle in nvl(field,' ') function.

    Refer VB sample on Passing LOB parameters to a stored procedure. It shows how to display and insert the image from VB form to an Oracle Database in a BLOB column.
    http://otn.oracle.com/sample_code/tech/windows/ole_db/oledb8/content.html
    Chandar

  • Issues with Macbook Pro display.

    Hi. Recently, I haven't been having too much luck with Apple products. It started with my Macbook pro Core 2 duo 2.16. It had screen issues, leading to the screen being replaced (replacement screen contained several dead pixels), alongside a logic board, video card, and sound board replacement over the short life of the computer. Apple recently replaced it with a new 2.4 GHz Macbook Pro.
    When I first turned it on, only 3 bottom pads made contact with my desk at all, causing the computer to become lob-sided. I brought it to the Apple store and they brought it to their back room to fix it (I am not sure about what they did to it though). The fix was mostly successful and brought the computer "within spec"... Shortly after the fix, I got home and my monitor started acting up by displaying black vertical bars along my screen. The left side of my screen was also disconnected from the aluminum frame; both issues can be seen at http://gallery.mac.com/eliete#100037 . The odd thing is that the issue only comes up every other time I use the computer, and closing-opening the clamshell usually cures the problem temporarily. I discovered that whenever I take a picture in Photo-booth, the screen flash aggravates the problem, making the issue very obvious, and obtrusive.
    I do a lot of photography work with Aperture 2 and Photoshop Elements 6, and performance wise, the computer is fantastic, but what good is a fast computer with an awful screen? I do not want to switch back to the PC platform because the Mac OS is just that much better, and I rely on this computer for many everyday tasks. What do you think I should do? - I would rather not have the screen replaced due to the possibility of dead pixels (VERY irritating when editing photos), but it looks like that may be the only option. Do you think that I should wait until the WWDC to see what update the MBP will see, incase they replace my computer a second time? Thank You in advance.

    First thing I'd to is take it to the Apple Store, you can talk with them about this. I'm sorry you have been having so much trouble, while Macs are good in general there are some lemons. I bought my current MacBook Pro in August. Within a few weeks of buying it, there were a handful of dead pixels on the display as well as a couple of pale spots (bruises that the Apple store said was my fault). I got the display (the entire top 1/2...display, iSight, etc.) replaced over Labor Day weekend and haven't had a dead pixel or blemish since then. If you wait until WWDC, there are two things to consider: 1) you will have the problem for a few more weeks, and 2) replacements may be refurbished laptops and not necessarily a new laptop. Why bother? If I were you, I'd take it in ASAP and see what options I'm given. If the screen is repaired and dead pixels arise, the screen can be replaced again. What's worse, the possibility of dead pixels, or putting up with the bad display for another month (or two...Apple has a history of introducing things at MacWorld and WWDC that aren't available until the following month)? Hope I helped.
    -AHeneen

  • How to  upload and display image using bsp application

    hi
    I  just wants to know that
    1- how to  upload image from BSP page with attachment into sap server .?
    2-how to display image in to BSP page(webpage).
    thanks

    Hello Gupta Prashant,
    Just to upload and display an image, import image in MIME repository. Not only still images but also flash files can also be uploaded in the MIME repository. Once you import the image in it, use normal html code for image call;
    <img src = "file.jpg/gif" width=  height=>
    Besides it, if your requirement is to store the image in the database and fetch it based on specified field-name, then you have to go for BLOBs i.e Binary Large Object, using this you can also store images, videos, pdfs, applications in the database.
    MBLOB - Medium BLOBs store videos and pdfs,
    LBLOB  - Large BLOBs store movie files and applications.
    You have got 2 ways to use it; some databases store BLOB objects into themselves and some store the path of the BLOB object maintained on the FTP server.
    You can also implement it in ABAP;
    read the following link and practice the tutorial;
    [ Use of MIME Types|http://help.sap.com/saphelp_45b/helpdata/en/f1/b4a6c4df3911d18e080000e8a48612/content.htm]
    also check this
    [TYPES - LOB HANDLE|http://help.sap.com/abapdocu/en/ABAPTYPES_LOB_HANDLE.htm]
    And looking at your question, in order to upload an image, you can make use of FILEUPLOAD tag provided by HTMLB.
    Step 1: FILEUPLOAD provides a browse button to choose desired image file.
    Step 2: Store that image in database using BLOBs.
    Step 3: Retrieve the image using normal select query and display it on the screen.
    Hope it helps you,
    Zahack

  • Displaying PDF file from database BLOB

    I have successfully added a PDF file to a table as a BLOB. Now, I need to display the BLOB. I have created the following package but it does not display anything. Can someone please help?
    SQL> create or replace package image_get
    2 as
    3 procedure pdf( p_id in demo.id%type );
    4 end;
    5 /
    Package created.
    SQL> create or replace package body image_get
    2 as
    3
    4 procedure pdf( p_id in demo.id%type )
    5 is
    6 l_lob blob;
    7 l_amt number default 30;
    8 l_off number default 1;
    9 l_raw raw(4096);
    10 begin
    11 select theBlob into l_lob
    12 from demo
    13 where id = p_id;
    14
    15 owa_util.mime_header( 'image/pdf' );
    16 begin
    17 loop
    18 dbms_lob.read(l_lob,l_amt,l_off,l_raw);
    19 htp.prn(utl_raw.cast_to_varchar2(l_raw));
    20 l_off := l_off+l_amt;
    21 l_amt := 4096;
    22 end loop;
    23 exception
    24 when no_data_found then
    25 NULL;
    26 end;
    27 end;
    28 end;
    29 /
    Package body created.
    SQL> DECLARE
    2 l_pdf int(1);
    3 begin
    4 l_pdf := 1;
    5 image_get.PDF(l_pdf);
    6 end;
    7 /
    PL/SQL procedure successfully completed.
    SQL> DECLARE
    2 Image1 BLOB;
    3 ImageNum NUMBER := 1;
    4 BEGIN
    5 SELECT TheBLOB INTO Image1 FROM demo
    6 WHERE id = ImageNum;
    7 DBMS_OUTPUT.PUT_LINE('Size of the Image is: ' ||
    8 DBMS_LOB.GETLENGTH(Image1));
    9 /* more LOB routines */
    10 END;
    11 /
    Size of the Image is: 14064
    PL/SQL procedure successfully completed.
    SQL> exit
    Am I missing something? I recently discovered that I need to set SERVEROUTPUT on to display the DBMS_OUTPUT. Is their some other environment variable I need to set.
    Thanks!

    *Always post code wrapped in <a href=http://wikis.sun.com/display/Forums/Forums+FAQ#ForumsFAQ-Arethereanyusefulformattingoptionsnotshownonthesidebar?"><tt>\...\</tt> tags</a>:*
      PROCEDURE lf_html_pdf (pv_image IN VARCHAR2, pv_index IN NUMBER) is
         l_mime        VARCHAR2 (255);
         l_length      NUMBER;
         l_file_name   VARCHAR2 (2000);
         lob_loc       BLOB;
      BEGIN
          begin
            selecT OI_BLOB,DBMS_LOB.getlength (OI_BLOB)
            into lob_loc,l_length
            from ord_img
            where  oi_tno= pv_image
              and oi_ti='PDF'
              and oi_idx=pv_index;
          exception
                when others then
                null;
            end;
         OWA_UTIL.mime_header (NVL (l_mime, 'application/pdf'), FALSE);
         HTP.p ('Content-length: ' || l_length);
         OWA_UTIL.http_header_close;
         WPG_DOCLOAD.download_file (lob_loc);
      END lf_html_pdf; Start by getting rid of:
          exception
                when others then
                null;and never using it anywhere ever again.
    If you're not actually going to use the <tt>l_mime</tt> and <tt>l_file_name</tt> variables then remove these as well. (Although I really think you should set a filename.)
    >
    Error report:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SYS.OWA_UTIL", line 356
    ORA-06512: at "SYS.OWA_UTIL", line 415
    ORA-06512: at "HCLABPRO.PKG_PDF", line 220
    ORA-06512: at line 2
    06502. 00000 - "PL/SQL: numeric or value error%s"
    >
    The error stack indicates that the exception is being raised in <tt>HCLABPRO.PKG_PDF</tt>: what is <tt>HCLABPRO.PKG_PDF</tt>? Does this actually have anything to do with the procedure above?
    I get the error message as below when i execute the procedure above;How do you execute it?
    What happens when it's executed without the <tt>when others...</tt> built-in bug?

  • Displaying images from ORDSYS.ORDIMAGE columns

    Does anyone know, if Oracle9i Reports can display images fetched from ORDIMAGE columns in the database? If so, could you give me a brief explanation how?
    Thanks in advance!

    Jacob,
    As of now , it is not supported. It is under development for next release.
    It currently supports images stored in DB as LOBs
    Thanks
    The Oracle Reports team

  • Display BLOB from remote database

    Context: We are offloading documents (pdf) from our OLTP database to a dedicated 'output database.' These documents must be displayed from the application on our OLTP database using a database link. Various posts show that querying a BLOB from a remote database can best be implemented using a query on the remote table and an insert on a local (temporary) table. So far, so good. The idea is to display this BLOB using wpg_docload.download_file.
    BUT:
    When trying to display the pdf from this global temporary table an error occurs:
    ORA-14453: attempt to use a LOB of a temporary table, whose data has already been purged
    When trying to display from a normal table and issuing a rollback after wpg_docload.download_file results in another error:
    ORA-22922: nonexistent LOB value
    When trying to display from a normal table and not removing the record in any way, its works fine. Only I now have a garbage collection issue, because the remote date remain in my local (preferably temporary) table.
    It seems to me that mod_plsql needs an active session to display my pdf.
    Does anyone have an explanation for this behaviour and maybe a solution for my problem?
    Environment:
    local: 10.2.0.4.0
    remote: 11.1.0.7.0
    pdf size: ca. 150kB
    code used:
    PROCEDURE show_doc (p_nta_id IN NUMBER
    ,p_sessie IN NUMBER
    IS
    t_lob BLOB;
    t_lob2 BLOB := empty_blob();
    t_mime VARCHAR2(100);
    BEGIN
    -- copy BLOB into local global temp table
    INSERT INTO mvs_tmp_notaprint_bestanden
    npv_nta_id
    , npv_npe_sessie
    , mime_type
    , bestand
    ) -- from remote table
    SELECT npd.npv_nta_id
    ,npd.npv_npe_sessie
    ,npd.mime_type
    ,npd.bestand
    FROM mvs_notaprint_bestanden@marc npd
    WHERE npd.npv_nta_id ; = p_nta_id
    AND npd.npv_npe_sessie = p_sessie
    -- show BLOB from local global temp table
    SELECT t.bestand
    , t.mime_type
    INTO t_lob
    , t_mime
    FROM mvs_tmp_notaprint_bestanden t
    WHERE t.npv_nta_id ; = p_nta_id
    AND t.npv_npe_sessie ; = p_sessie
    t_lob2 := t_lob; -- buffer BLOB
    owa_util.mime_header(t_mime , FALSE );
    owa_util.http_header_close;
    wpg_docload.download_file(t_lob2);
    END show_doc;

    Andrew,
    thank you, the 'preserve rows' did the trick.
    Every query from a browser (even in the same browser session) is a new Oracle session, so the copied records in the global temporary table are gone after the page is displayed.
    Am I correct in assuming that each call from the browser results in a new Oracle session? I did a few tests and found for each call a different sessionid.
    Sincerly,
    Arne Suverein
    Edited by: Arne Suverein on Aug 18, 2009 3:35 PM

  • Abstract lobs increases with every call and not released

    Running on 11.2.0.2
    We're generating some xml web feeds for our website from relational data using SQL/XML operators. I fetch the xml into a PLSQL CLOB variable using XMLSERIALIZE, which i then return to my java application.
    Our site has seen a huge increase in activity and requests to our feeds, and our DBA is reporting we're running out of temp tablespace. We've increased temp tablespace, but he also mentioned that memory consumption is steadily increasing, eventually, DB instance needs to be bounced, otherwise it crashes.
    I've discovered that my block of code that builds and returns the xml is causing abstract lobs to increase, but never recedes.
    Re-reading the following from 11gr2 Large Objects guide:
    Temporary LOBs created in a program block as a result of a SELECT or an assignment are freed automatically at the end of the PL/SQL block or function or procedure. You must also free the temporary LOBs that were created with DBMS_LOB.CREATETEMPORARY to reclaim system resources and temporary tablespace. Do this by calling DBMS_LOB.FREETEMPORARY on the CLOB variable.
    Note:
    If the SQL statement returns a LOB or a LOB is an OUT parameter for a PL/SQL function or procedure, you must test if it is a temporary LOB, and if it is, then free it after you are done with it.
    Also learned the following (as of 10gr2)
    A new column named 'ABSTRACT_LOBS' has been added to the V$TEMPORARY_LOBS table. This column displays the number of abstract LOBs accumulated in the current session. Abstract LOBs are temporary lobs returned from queries involving XMLType columns.
    so my question is, is my java application responsible for freeing up the LOB? It seems freeing the lob in my PL/SQL function has no effect, since it returns the LOB to JAVA.

    Hi Odie,
    Calling it with an CallableStatement... packaged function returns a clob.
    My DBA is having trouble tracking down the temp lob usage in production it seems. And I question whether my little test case i did in our development environment is actually correct. I tested by calling my packaged function in a sql statement then selecting from v$temporary_lobs. that is where i was seeing abstract_lobs increasing.
    Not 100% sure this is what is happening though when calling from an CallableStatement in Java.
    That said, I have added some java code to check whether the CLOB returned from my function is temporary, and if so, I free it using the oracle.sql.CLOB implementation. The java code is logging that it is indeed a temporary lob and does free it. I can't confirm though whether this is impacting the temp lob count in the DB, since I believe v$temporary_lobs is based on current session.

  • Display Image from the database but prevent it from refreshing on every pages

    Hi there,
    I can see there are many discussions around this but my query is slightly different. I'm writing this on behalf of one of my developers. (sorry for my ignorance on techie stuff.. :-))
    A logo is being displayed on a few pages, which is called from the database. However, the problem is that  - this logo refreshes every time when you traverse to each page causing a performance issue or sometimes slow loading of the image.
    My question is - how do we stop it from loading on each page from the database?.  I would rather load once when the main page loads initially and then maintain this on other pages too.
    We can keep this logo on a file system (FS)  and display it via CSS/HTML/frame but since we want to keep it flexible/dynamic where a user can upload a new one whenever it changes and hence DB seems to be the suitable option (in my opinion).
    Can someone please help?
    If you need any further info around the coding how it is being done at present, pls let me know.
    Thank you

    read this http://docs.oracle.com/cd/B28359_01/appdev.111/b28393/adlob_tables.htm#g1017777
    you can cache lobs in the database too
    you can also upload the pic in your file system using utl_file package and then put the image in the working directory mentioned in i.war
    you can then reference the image and it will not be stored in the database and will be cached
    Regards,
    Vishal
    Oracle APEX 4.2 Reporting | Packt Publishing
    Vishal's blog

  • Displaying more than 4000 characters

    Hi
    I have a report which would display a CLOB field having text of length around 32000 characters.
    I tried to use DBMS_LOB.SUBSTR(<field_name>,32000,1) on the query so that it shows the text at least till 32000 characters on the report but it keeps returning an error ORA-06502 PL/SQL: numeric or value error string - character string buffer too small whenever it is more than 4000 characters in that particular field.
    Can anyone pls suggest any solution ASAP?
    Thanks
    Arnab

    You can split your clob in varchar2 4000 drop table tab1;
    create table tab1 (
      clsplit_id                   number(10)        NOT NULL,
      clsplit_type1val          CLOB                 NULL,
      clsplit_type2val          CLOB                 NULL
    drop type some_list;
    drop type my_t;
    create type my_t as object
          id1 number,
          clob_type number,
          no_clob_lines      number,
          clob_line      number,
          clob_data      varchar2(80)
    show errors
    create type some_list as table of my_t
    show errors
    insert into tab1 values(1, 'a0123456789b0123456789c0123456789d0123456789e0123456789f0123456789leftover',
          'a9876543210b9876543210c9876543210d9876543210e9876543210f9876543210leftover');
    insert into tab1 values(2, '0aaaaaaaaaa1bbbbbbbbbb2cccccccccc3dddddddddd4eeeeeeeeee5ffffffffff',
          'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    insert into tab1 values(3, 'first has data, second null', null);
    insert into tab1 values(4, null, 'first null second has data');
    insert into tab1 values(5, 'short lob', 'short lob');
    commit;
    create or replace function some_func return some_list pipelined is
          num_allowed_chars      number      := 4000;
          clob1_len                  number;
          clob2_len                  number;
          loop_counter            number;
          col_name                  varchar2(100);
          current_line            number;
          i                              integer;
            out_rec my_t := my_t(NULL,NULL,NULL,NULL,NULL);
    begin
          for c1 in ( select clsplit_id, clsplit_type1val, clsplit_type2val from tab1 )
          loop
                -- get first clob
                if c1.clsplit_type1val is not null then
                      clob1_len := dbms_lob.getlength(c1.clsplit_type1val);
                      if clob1_len > num_allowed_chars then
                            for i in 1..ceil(clob1_len/num_allowed_chars) loop
                                  out_rec.id1 := c1.clsplit_id;
                                  out_rec.clob_type := 1;
                                  out_rec.no_clob_lines := ceil(clob1_len/num_allowed_chars);
                                  out_rec.clob_line := i;
                                  out_rec.clob_data := substr(c1.clsplit_type1val,( i * num_allowed_chars ) - num_allowed_chars + 1,num_allowed_chars);
                                  pipe row(out_rec);
                            end loop;
                      else
                                  out_rec.id1 := c1.clsplit_id;
                                  out_rec.clob_type := 1;
                                  out_rec.no_clob_lines := 1;
                                  out_rec.clob_line := 1;
                                  out_rec.clob_data := c1.clsplit_type1val;
                                  pipe row(out_rec);
                      end if;
                end if;
                -- get second clob
                if c1.clsplit_type2val is not null then
                      clob2_len := dbms_lob.getlength(c1.clsplit_type2val);
                      if clob2_len > num_allowed_chars then
                            for i in 1..ceil(clob2_len/num_allowed_chars) loop
                                  out_rec.id1 := c1.clsplit_id;
                                  out_rec.clob_type := 2;
                                  out_rec.no_clob_lines := ceil(clob2_len/num_allowed_chars);
                                  out_rec.clob_line := i;
                                  out_rec.clob_data := substr(c1.clsplit_type2val,( i * num_allowed_chars ) - num_allowed_chars + 1,num_allowed_chars);
                                  pipe row(out_rec);
                            end loop;
                      else
                                  out_rec.id1 := c1.clsplit_id;
                                  out_rec.clob_type := 2;
                                  out_rec.no_clob_lines := 1;
                                  out_rec.clob_line := 1;
                                  out_rec.clob_data := c1.clsplit_type2val;
                                  pipe row(out_rec);
                      end if;
                end if;
          end loop;
          return;
    end;
    show errors
    select * from
    table(select some_func() from dual)
    order by 1,2,4;

Maybe you are looking for