Problem in generating the output

Hi,
I am new to Oracle XML.I'm using Oracle 10g(10.1 - 10.2) as my backend DB. I have the code below. Its purpose is to display the following values:
for id_number:
1
2
for first_name:
JOHN
MICHAEL
CREATE OR REPLACE procedure parse_CLOB1 as
l_clob CLOB := '';
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl dbms_xmldom.DOMNodeList;
l_cnl dbms_xmldom.DOMNodeList;
l_inl dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
l_childNode dbms_xmldom.DOMNode;
l_icnode dbms_xmldom.DOMNode;
l_default_path VARCHAR2(33) := '/EMPLOYEE_REC/EMPLOYEES/RECORD';
l_temp VARCHAR2(500) := '';
l_value VARCHAR2(500) := '';
begin
l_clob := '<EMPLOYEE_REC>
<DEPARTMENT>104</DEPARTMENT>
<EMPLOYEES>
<RECORD>
<ID_NUMBER>1</ID_NUMBER>
<FIRST_NAME>JOHN</FIRST_NAME>
</RECORD>
<RECORD>
<ID_NUMBER>2</ID_NUMBER>
<FIRST_NAME>MICHAEL</FIRST_NAME>
</RECORD>
</EMPLOYEES>
</EMPLOYEE_REC>';
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),l_default_path);
FOR c IN 0 .. (dbms_xmldom.getLength(l_nl) - 1)
LOOP
l_n := dbms_xmldom.item(l_nl, c);
l_cnl := dbms_xmldom.getchildnodes(l_n);
l_childnode := dbms_xmldom.item(l_cnl, c);
l_temp := dbms_xmldom.getnodename(l_childnode);
dbms_output.put_line('The value of the inner element is: '||l_temp);
-- get the value of the inner node
     l_inl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),l_default_path||'/'||l_temp);
     for d in 0 .. (dbms_xmldom.getLength(l_inl) - 1)
     loop
     l_icnode := dbms_xmldom.item(l_inl, c);
     l_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_icnode));
     dbms_output.put_line(l_value);
     end loop;
end loop;
dbms_xmldom.freeDocument(l_doc);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('FAIL');
dbms_output.put_line(sqlerrm);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
end parse_CLOB1;
My problem is that I'm getting the wrong output below:
The value of the inner element is: ID_NUMBER
1
1
The value of the inner element is: FIRST_NAME
MICHAEL
MICHAEL
Can you help me about this?
Thanks,
Jun

Hi,
I already found the cause. I still use the variable c in my inner loop which is supposed to be d
Regards,
Jun

Similar Messages

  • How to generate the output of a BSP application in PDF format?

    Hi,
    I need to modify one BSP application, which generates its output in the form of PDF. I have checked all the methods in the bsp pages and its corresponding controller class's. I couldn't find any relevant method, which deals with generating the output in PDF.
    Could you please share your valuable thoughts on this?
    Again it would be helpful, If anyone of you share some knowledge on Interactive Adobe Forms.
    Thanks,
    John

    >
    I am using oracle version 11.2.0.1, I have set a cronjob which will run on every 15 minutes and give us a log file mentioning the execution time taken for that SQL query:-
    The above query will return the output as well as the time taken for execution of the query. I want to suppress the output of the query and only want the time taken to be printed. Is it possible by set commands. I have marked the output as bold and made it Italic.
    >
    How would that even be useful?
    A query from a tool such as sql*plus is STILL going to send the output to the client and the client. You can keep sql*plus from actually displaying the data by setting autotrace to trace only.
    But that TIME TAKEN is still going to include the network time it takes to send ALL rows that the query returns across the network.
    That time is NOT the same as the actual execution time of the query. So unless you are trying to determine how long it takes to send the data over the network your 'timing' method is rather flawed.
    Why don't you tell us WHAT PROBLEM you are trying to solve so we can help you solve it?

  • Can we generate the output of SQL Query in XML format ..

    Hi Team,
    Can we generate an XML doc for an SQL Query.
    I've seen in SQL Server 2000.It is generating the output of an SQL Query in xml format.
    select * from emp for xml auto
    The output looks like
    <emp EMPNO="7369" ENAME="SMITH" JOB="CLERK" MGR="7902" HIREDATE="1980-12-17T00:00:00" SAL="2800" DEPTNO="20"/><emp EMPNO="7370" ENAME="SMITH" JOB="CLERK" MGR="7902" HIREDATE="1980-12-17T00:00:00" SAL="2800" DEPTNO="10"/>

    Just a little bit of short hand.
    Get the XML out of your database, via HTTP
    Of course the easiest method is just to return an XMLType from a stored procedure and let the calling routine figure out what to do with it. Instead
    of that way though, I'll show you how to do it via HTTP. It's all completely built into 10g and is super easy to use.
    CREATE OR REPLACE VIEW emps_and_depts AS
    SELECT e.employee_id AS "EmployeeId",
    e.last_name AS "Name",
    e.job_id AS "Job",
    e.manager_id AS "Manager",
    e.hire_date AS "HireDate",
    e.salary AS "Salary",
    e.commission_pct AS "Commission",
    XMLFOREST (
    d.department_id AS "DeptNo",
    d.department_name AS "DeptName",
    d.location_id AS "Location"
    ) AS "Dept"
    FROM employees e, departments d
    WHERE e.department_id = d.department_id
    Some people hear web and immediately start salivating about security issues. Let me address that quickly. Just because you have the HTTP and/or
    FTP servers running in the database, that does not mean you have a security problem. For one, I would hope your databases are behind a firewall.
    Second, with the correct architecture (DMZ, app servers, etc) you can make this data available outside the firewall fairly transparently and third,
    just because it's on the web does not mean the data MUST be available on the internet. This is a good way to make your data available on your
    intranet. If you are worried about people INSIDE your firewall, that still doesn't preclude web based access. Follow Oracle security guidelines.
    Before I show you how to get to your data, let's talk about URLs and URIs. A URL is a Uniform Resource Locater and URI is a Uniform Resource
    Identifier. A URL is the way you would identify a document on the net, i.e. http://www.oracle.com is a URL. A URI is a more generic form of a URL.
    Oracle supports three types of URI: HTTPURIType - basically a URL (which would be like the URL above), XDURIType - a pointer to an XDB resource
    (usually an XML document but can be other objects), and DBURIType - a pointer to database objects.
    It's the DBURIType that we're going to concentrate on here. The DBURIType let's us reference database objects using a file/folder paradigm. The
    format for a DBURI is /oradb/<schema>/<table>. Oradb is shorthand for the database; it is not the database name or SID. My database is named XE
    but I still use oradb in the DBURI. For example, the view we created above is in my XE database, is owned by HR (at least in my case) and is called
    EMPS_AND_DEPTS. This can be referenced as /oradb/HR/EMPS_AND_DEPTS.
    If the view had many rows and you wanted only one of them, you can restrict it by including a predicate. The documentation for XDB has a great
    write up on Using DBURIs.In our case, we are going to write out the entire document. Now that you understand that the DBURI is a pointer to
    objects in our instance, we can use that to access the data as a URL.
    The format for the URL call is http://<machinename>:<port>/<DBURI>
    In my case, my XE database is running on a machine called mach1 and is listening on port 8080. So to see the view we created above, I open my
    browser and navigate to: http//mach1:8080/oradb/HR/EMPS_AND_DEPTS
    The created URL will be as http//mach1:8080/oradb/PUBLIC/EMPS_AND_DEPTS
    If your database is set up correctly and listening on port 8080 (the default), your browser should ask you to login. Login as the user who created the
    view (in my case HR). You should now get an XML document displayed in your browser.
    And that's it. It doesn't get much simpler than that. If you get rid of the descriptive text above, it basically comes down to:
    Create a table or view
    Open your web browser
    Enter a URL
    Enter a user ID and password
    View your XML
    If you notice, Oracle formatted the data as XML for us. Our view returns scalar columns and an XML fragment called Dept. Oracle formatted the
    return results into an XML format.
    And as a side note, if you look closely, you'll see that my URL has PUBLIC where I said to put HR. PUBLIC is a synonym for all objects that your
    logged in user can see. That way, if your user has been granted select access on many schemas, you can use PUBLIC and see any of them.

  • Txt output problem,cannot order the output

    Hi,
    I'm working with forms and reports 6i, and I have a problem when generating the .txt output.
    My report consists in some columns (database-scalar) from the main query and in some columns(formula).
    What I'm trying to do is to mix the order of columns (database-scalar) and columns(formula),but
    I can't do it. The columns(formula) are always in the end of the output...
    I've put the right order in the report editor,but It only works to put the order of the columns (database-scalar) .
    Example
    query
    select a,b,c from..where...
    formula colum: desc_a,desc_b
    The desired output
    a desc_a b desc_b c
    The output I get
    a b c desc_a desc_b
    Thanks in advance

    Solved,reading anothers posts found the error.
    Just need to play with the "break order" and separating in groups the formula column and the database-scalar colum.

  • Problems while generating the report........

    Hi Experts,
    I have genereated a new report on purchasing data, I am facing bellow problems while generating the report,
    1) In rows one Invoice doc num is there, I am not getting result row for this object, I have given NEVER in supress result rows in properties of that object, but it's not showing.....how can i get result row for this object?
    2) I am getting '#' for the blank values, How to remove these '#"s
    Please help to solve my above problems,
    Helpful answer will be awarded with points,
    Thanks in advance,
    Venkat.

    Hi,
    1) If you have only Invoice Num it does not shows the result Row .
    2)If you display the characteristics as Key u will get as '#'. You can select as Text,then it will show 'Not Assigned'. (Hope you know that when the Values not updated from Infoprovider then # appears at output )
    Hope it helps

  • Problem in determining the output (Print, ALE, etc)  for Exchange document

    Hi Experts,
    I am facing a problem in getting the output for certain Exchange netting documents. If I remove Exchange contract number from the netting document, The out put is getting generated as required. But if a Exchange contract number is mentioned in the Netting documents ( the case is appearing only for couple of netting documents) the out is not getting generated. On analysing, system gives message that it is not able to find the required partner role ( its Bill to party in this case). But BP partner roles is  set.
    Please let me know which are the partner roles that are required for this output determination.
    Thanks a lot,
    Amit Kothari
    Edited by: Amit Kothari on Apr 28, 2009 1:07 PM
    Edited by: Amit Kothari on Apr 28, 2009 1:08 PM

    Hi Experts,
    I am facing a problem in getting the output for certain Exchange netting documents. If I remove Exchange contract number from the netting document, The out put is getting generated as required. But if a Exchange contract number is mentioned in the Netting documents ( the case is appearing only for couple of netting documents) the out is not getting generated. On analysing, system gives message that it is not able to find the required partner role ( its Bill to party in this case). But BP partner roles is  set.
    Please let me know which are the partner roles that are required for this output determination.
    Thanks a lot,
    Amit Kothari
    Edited by: Amit Kothari on Apr 28, 2009 1:07 PM
    Edited by: Amit Kothari on Apr 28, 2009 1:08 PM

  • Unable to generate the output for S_ALR_87012048

    Dear All,
    We are trying to execute the report  S_ALR_87012048 for the first period in 2015.  We have tried execute this report with report date 25.01.2015 (which is the last day in period 01), but it is giving no data was selected.
    Can anybody suggest whether I need to give any further inputs to generate the output apart from the below.
    Co.code : 9000
    Reporting date : 25.01.2015 (which is the last day in our fiscal period 01 /2015)
    Dep area : 01
    Sort Variant : 03 (co.code / bs  accounts / asset class)
    User able to execute this report in the last month successfully.
    We have completed all year ending process as well.
    I have tried execute this report in our quality system with reporting date as 31.12.2014 and 31.12.2015.
    Do we need to give reporting date as year ending date ? or last date of current period.
    Thanks in Advance.
    Prasad

    Hi Prasad,
    I do believe that you should consider the authorization side of the matter carefully as pointed out by Mahmoud on Feb 6th. Please check again the mentioned SAP Notes in that thread.
    For example, I just tested in my system, I can trigger a report even in a closed fiscal year with a report date end of each period. The only difference is that I get a information message:
    Report date is in a closed fiscal year
    Message no. AU172
    Diagnosis
    The report date is in the past.
    Here the report date is allowed to be the end of the year as well as any
    period end during the fiscal year.
    System Response
    In an asset report during the fiscal year (report date for a period end
    within the year) in a closed fiscal year, it can be the case that the results
    for depreciation or the net book value are different between the historical
    calculation and the current calculation for the report date. The reason for this
    are any changes to asset-related depreciation terms, such as the depreciation
    key, useful life, and so on. In the case of such changes, the asset values are
    recalculated with the currently entered depreciation terms.
    In an open fiscal year and a report date end of period I do not get AU172 and get an output.
    Beside above provided SAP Notes, also see another couple of SAP Notes with some interesting information are also:
    1566099  Reporting in Asset Accounting
    1491612  Authorization concept in FI-AA
    1394450  Reporting: Authorization check for report assignment
    929732    Authorization checks: Correction Note 856248
    856248   Authorization checks in asset reporting
    Regards,
    Brigitte

  • Problems while generating the proxy definition

    Hi Experts,
       I am facing the error " Problems while generating the Proxy Definition! ", when creating the proxy definition, for a specific URL.
    The URL to call the webservice is similar to "http://www3.XYZ.com/_vti_bin/newswebservice.asmx?WSDL" and is returning the appropriate XML code. Moreover accessing the webservice through browser, returns the expected response, too.
    From the NWDS side, where we are creating the proxy, again, everything is fine, because we have already created two proxy definitions, in similar fashion, but for different WSDL links.
    The only difference we are encountering is like, earlier the links were of type "www.abc.com/..." while the new URL is of type "www3.xyz.com/..." type. I hope this load balancing technique has hardly to do anything with it.
    Any pointers for possible reasons and solutions will be of much help.
    Regards,
    Akhil Mishra

    If you are consuming a web service in NWDS look below document and check if you are not missing any step:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0cf9e42-ccb0-2c10-d0a4-f5aa8a79e19a

  • Problem in generating the Oracle report6i to PDF file.

    Hi guys,
    I had encounter problem in generating the Oracle report6i to PDF file. The Amount column once the report is genrated to PDF it double the amount reflected in the PDF file report. See sample scenarios below:
    Can anybody help me explain this issue how it really happens?
    Example:
    FROM ORACLE REPORTS6i :
    ITEM # PRODUCT AMOUNT
    1 PRINTER 5,000
    2 KEYBOARD 2,000
    TO PDF FILE :
    ITEM # PRODUCT AMOUNT
    1 PRINTER 10,000
    2 KEYBOARD 4,000
    Thank you.
    Lala

    Hi "LawlordsX",
    I do understand the issue, something seems to have messed up the Shell Extensions on the 2 Lenovo laptops you talked about.
    Could you please check if the 2 m/c(s) have an additional version of Office installed in parellal to Office 2007, say Office 2010 trial pre-installed on them. This can be verified via CONTROL PANEL > PROGRAMS AND FEATURES > Check for the versions of Office installed. If yes, please let me know the additional Office software version/type.
    Also, could you be more specific about the bitage of the system, i.e. whether the Windows 7 m/c is 32-bit or 64-bit?
    This can be checked from CONTROL PANEL > SYSTEM > Under "System" section check for "System Type".
    If converting multiple files at a time to PDF is an issue, as an alternate you could use FILE > CREATE > BATCH CREATE MULTIPLE FILES to workaround the problem for the time being.
    Thanks!

  • How to generate the output of BSP application in PDF format?

    Hi,
    I need to modify one BSP application, which generates its output in the form of PDF. I have checked all the methods in the bsp pages and its corresponding controller class's. I couldn't find any relevant method, which deals with generating the output in PDF.
    Could you please share your valuable thoughts on this?
    Again it would be helpful, If anyone of you share some knowledge on Interactive Adobe Forms.
    Thanks,
    John

    okay, awesome
    i'd use DOM or some high level API for this (don't write it by hand using plain File IO)
    okay, try this site, it goes through building a document, adding elements, writing to file, etc.
    http://www.roseindia.net/xml/dom/

  • Error generating the output preview

    Hi friends!
    Could you help me u2013 when I run Output Preview in bit invitation process Iu2019ve got a system error u201CError generating the output previewu201D. 
    What could be a reason?

    Note 1172470 - BBP_BID: Error generating the output preview
    Note Language: English Version: 3 Validity: Valid from 26.05.2008
    Summary
    Symptom
    From transaction "Process bid"(BBP_QUOT) when you click on print preview,
    you get the error "Error generating the output preview". Due to this error
    the preview is not displayed.
    More Terms
    BBP_BID 210, output preview, print preview, preview, bid, quotation, quot,
    BBP_QUOT, BBP_OUTPUT, SAPLBBP_OUTPUT, pdf, BBP_OUTPUT_QUOT_PREVIEW_SMART,
    SYSTEM_INSTALLED_LANGUAGES.
    Cause and Prerequisites
    This is caused by a program error.
    Solution
    Implement the attached corrections or import the corresponding support
    package
    Header Data
    Release Status: Released for Customer
    Released on: 26.05.2008 11:14:52
    Priority: Correction with medium priority
    Category: Program error
    Main Component SRM-EBP-CA-PRT Document Output / Forms
    Additional Components:
    SRM-EBP-QUO Quotation, Bid
    Valid Releases
    Software Component Release From
    Release
    To Release and Following
    SRM_SERVER 550 550 550
    Support Packages
    Support Packages Release Package Name
    SRM_SERVER 550 SAPKIBKT13
    SRM_SERVER 600 SAPKIBKU05
    Please raise customer message

  • Problems in generating excel output

    Hi all,
    I'm facing a problem submitting a report with XML output (XML Publisher 5.0.1). I created a RTF template in order to generate an excel output but when I launch the concurrent, its status after few minutes becomes "Warning" logging java.lang.OutOfMemoryError. The strangest thing is that the PDF output generates normally without errors or warnings.
    I've found on metalink a note in which they suggest to create a configuration file (xdo.cfg) where i've declared a temporary folder in order to split the XML in two parts to allow the XDO to create correctly my excel output....but it didnt work! :(
    After that I added to my concurrent execution options the string "-Xmx512m" to increase the memory for that particular task (even if i think that 128 mb for a XML file of 5 MB are more than necessary)... but no results (in this case i've had another error "java.io.FileNotFoundException: /opt/app/oracle//admin/out//o2260792.out (No such file or directory)" ).
    Can someone help me??
    Is it a normal behaviour?? It seems to be a joke, cause in metalink they suggest everybody to apply patches and patches!!
    Thx all

    Hi Nisha,
    Refer to that link.....May be it will helpful for you....
    Are You All Able to get the Output In EXCEL Format
    Otherwise you can do one thing......Add one more Viewer option for XML type data... Most probably earlier For viewing the XML data you are using Browser... So by default whenever you are trying to see the output it is opening it in Browser....
    Now add one more Viewer option For XML as Microsoft Excel......
    So After making two viewer option for XML data whenever you will try to see the output of XML data it will ask you...Viewing option...1.Browser 2. Excel
    Choose Excel here it will not give you any error and you will be able to open the output in Excel format.....
    Regards
    Ravi

  • Weird problem when downloading the output to an excel sheet

    Hi to all,
          when i download the list, output by an alv grid, i observe a weird problem..in the excel sheet the last digit (10th digit) of the first col. which is delivery no., is getting truncated...0001802563 is getting downloaded as 000180256..couldn't understand why...when i use conversion_exit fm, the values are not getting truncated and downloading correctly...curious to know what's gone wrong in this funcationality? thanks all
    cheers,
    Shankar. M.

    actually the problem is in the field catalog.if u can send me the code, i shall bug fix it for u.

  • Problem in printing the output of a script.

    dear friends,
    I have a script program which is running fine and the it has generated the desired output in one page on the screen. But when i am transfering the output to the printer the same output is splitting into 3 pages and special character is printing in begining and ending of every line. In the first page It is printing the special character, in the second it is printing the first line output and in the third page rest of the output.
    In my script i have only the main window. i want the script output to be printed only in one page on the printer . Please help me with your suggestions.

    Sravan,
    Check ur printer as sometimes it so happens that the printers act up and spoil output...

  • Problem in generating the Primary Key

    Hi All ,
    I am trying to persist an object and also generating the primary key using a default sequence . But the problem is that the Primary key is getting incremented by 2 instead of 1 . My code looks like this :
    import java.util.HashMap;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.EntityTransaction;
    import javax.persistence.Persistence;
    import javax.persistence.PersistenceContext;
    import javax.persistence.PersistenceContextType;
    import javax.persistence.PersistenceUnit;
    public class entityCaller {
    //     @PersistenceContext(unitName="testApp" ,type=PersistenceContextType.EXTENDED)
         EntityManager em;
    //     @PersistenceUnit(unitName="testApp")
         EntityManagerFactory emf ;
         public void persistEntity( String Name , int Age ) {
              EntityManagerFactory emf =
              Persistence.createEntityManagerFactory("testApp", new HashMap());
              em = emf.createEntityManager();
              EntityTransaction entityTransaction = em.getTransaction();
         Tab1 oBJTab1 = new Tab1();
    //      oBJTab1.setId(Age);
         oBJTab1.setVal(Name);
              try{
                   System.out.println("Making object");
                   em.persist(oBJTab1);
                   System.out.println("Done");
                   System.out.println("Making object2");
                   System.out.println("Entered the Values");
              }catch (Exception e) {
                   e.printStackTrace();
              }finally{
              em.close();
         public static void main(String[] args) {
              entityCaller caller = new entityCaller();
              caller.persistEntity("DoAgain7",2);
    My persistence.xml looks like this :
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="testApp">
    <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
    <class>Tab1</class>
    <!-- <jta-data-source>java:/XAOracleDS</jta-data-source>     -->
    <properties>
    <!-- Provider-specific connection properties -->
    <property name="toplink.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="toplink.jdbc.url" value="jdbc:oracle:thin:@127.0.0.1:1521:XE"/>
    <property name="toplink.jdbc.user" value="system"/>
    <property name="toplink.jdbc.password" value="jlkklkj"/>
    <!-- Provider-specific settings -->
    <!-- other values are: drop-and-create-tables|none -->
    </properties>
    </persistence-unit>
    </persistence>
    Please provide me with some pointer as to know where the things are going wrong.

    If you generated your original schema using toplink.ddl-generation, then later dropped it and created it then you should keep in mind the sequence table does not get dropped. This can lead to an initially 'empty' database with a PK sequence starting at '2' if you have one persistence unit and one entity. Can you steadily duplicate this or did you just notice that your persist started with an key of '2'? Just a thought.

Maybe you are looking for