Writing generated XML into a file after comparing with other XML

Hi,
  I have completed the comparison of two XML now I have a requirement to concat these two xml but also need to append the XML with a status node that if after comparing the two XML output is Y or N so if it is Y then a node with
<status>Y</status>
<from table>t1</from table>
then completing those task I need to write it in a file
declare
    p_emp_info   CLOB;
  l_emp_tab        xmlsequencetype := xmlsequencetype();
BEGIN
  FOR i IN (SELECT id from emp WHERE emp_name='ABC') LOOP
    l_emp_tab.extend;
    SELECT XMLELEMENT("ABCD",
           XMLELEMENT("id",i.id))
      INTO l_emp_tab(i)
      FROM dual;
END LOOP;
  SELECT XMLELEMENT("EMP"
                       ,XMLAGG(t.column_value))
    INTO p_emp_info  
    FROM TABLE(l_emp_tab) t;
    --Dbms_Output.put_line(getclobval(1,2));
EXCEPTION
    WHEN OTHERS THEN
   Dbms_Output.put_line(SQLCODE||sqlerrm);
END ;
I am using this query but it is giving me an error that expression is of wrong type  at this line {  INTO l_emp_tab(I) }
I am unable to find out the error that what I am missing here !!

You've changed the datatype of i from the example that Odie gave you in
repeating nodes using FOR loop but when concating XML string then concating only last iteration of FOr loop ??
In his example, i was a number.  In your above code, i is now the rowset for a cursor.
You could rewrite your version to look like
declare
  p_emp_info     XMLTYPE;
  l_emp_tab      xmlsequencetype := xmlsequencetype();
  l_pos          PLS_INTEGER;
  CURSOR c_info IS
    SELECT id
      from emp
     WHERE emp_name='ABC';
BEGIN
  FOR r_info IN c_info LOOP
    l_emp_tab.extend;
    l_pos := c_info%ROWCOUNT;
    SELECT XMLELEMENT("ABCD",
           XMLELEMENT("id",r_info.id))
      INTO l_emp_tab(l_pos)
      FROM dual;
  END LOOP;
  SELECT XMLELEMENT("EMP"
                       ,XMLAGG(t.column_value))
    INTO p_emp_info 
    FROM TABLE(l_emp_tab) t;
  --Dbms_Output.put_line(p_emp_info.getclobval());
END ;
You can't use the c_info%ROWCOUNT in the INTO clause, hence the need for l_pos.
Or you could rewrite it to be
declare
  p_emp_info   XMLTYPE;
  l_clob       CLOB;
BEGIN
  SELECT XMLElement("EMP",
           XMLAgg(XMLElement("ABCD",
                    XMLElement("id",e.id))))
    INTO p_emp_info
    FROM emp e
   WHERE emp_name = 'ABC';
  SELECT XMLSERIALIZE(DOCUMENT p_emp_info AS CLOB)
    INTO l_clob
    FROM DUAL;
  Dbms_Output.put_line(l_clob);
END;
Both produce the same XML.

Similar Messages

  • Removal of data from 1 table after comparing with other table

    Hi,
    I have 2 table. Both have same primary key i.e. WO_ID. 1st table wrk_ord have no redundant data and the 2nd table wo_audit have few redundant data. Both table are related with WO_ID. Now I want to remove the redundant data from table wo_audit so that the uniq WO would be same in both the table. both the table are very huge. WO_ID table have 31million of record. I ran query
    delete from wo_audit where wo_id not in (select wo_id from wrk_ord);
    this query throw an error ora-01555. I just want to know the how can optimize this query.
    Thanks.

    Hi,
    delete from wo_audit where wo_id not in (select wo_id from wrk_ord);AFAIk, you not removing redundant data, but you are removing the data which does not exists in wrk_ord. Try to check things from business perspective.
    Tune the value of the UNDO_RETENTION parameter, check the the below one
    select max(maxquerylen) from v$undostat;
    - Pavan Kumar N
    Edited by: Pavan Kumar on Apr 8, 2011 1:36 PM

  • Error while writing the data into the file . can u please help in this.

    The following error i am getting while writing the data into the file.
    <bindingFault xmlns="http://schemas.oracle.com/bpel/extension">
    <part name="code">
    <code>null</code>
    </part>
    <part name="summary">
    <summary>file:/C:/oracle/OraBPELPM_1/integration/orabpel/domains/default/tmp/
    .bpel_MainDispatchProcess_1.0.jar/IntermediateOutputFile.wsdl
    [ Write_ptt::Write(Root-Element) ] - WSIF JCA Execute of operation
    'Write' failed due to: Error in opening
    file for writing. Cannot open file:
    C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\
    BPEL_Import_with_Dynamic_Transformation\WORKDIRS\SampleImportProcess1\input for writing. ;
    nested exception is: ORABPEL-11058 Error in opening file for writing.
    Cannot open file: C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\
    BPEL_Import_with_Dynamic_Transformation
    \WORKDIRS\SampleImportProcess1\input for writing. Please ensure 1.
    Specified output Dir has write permission 2.
    Output filename has not exceeded the max chararters allowed by the
    OS and 3. Local File System has enough space
    .</summary>
    </part>
    <part name="detail">
    <detail>null</detail>
    </part>
    </bindingFault>

    Hi there,
    Have you verified the suggestions in the error message?
    Cannot open file: C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\BPEL_Import_with_Dynamic_Transformation\WORKDIRS\SampleImportProcess1\input for writing.
    Please ensure
    1. Specified output Dir has write permission
    2. Output filename has not exceeded the max chararters allowed by the OS and
    3. Local File System has enough space
    I am also curious why you are writing to a directory with the name "..\SampleImportProcess1\input" ?

  • EA1 - File Compare With Other File... Does Not Work

    I open a file in the SQL Worksheet, select File > Compare With > Other File..., nothing happens! Is this part of the Version Control feature that is yet to be implemented?

    I have it logged.
    Thanks
    Sue

  • When I open an encryted pdf file in my Hp  Slate 7 voice Tab it was unable to open the pdf file.Tje same file was opening with other pdf reader software.Kindly Help.

    When I open an encryted pdf file in my Hp  Slate 7 voice Tab it was unable to open the pdf file.Tje same file was opening with other pdf reader software.Kindly Help.
    [spam link removed]

    Could you please send the pdf to [email protected] so that we may investigate the issue?
    Thanks,
    Adobe Reader Team

  • How to share any file via bluetooth with other phones?

    how to transfer file via bluetooth with other phone?

    Ntsako wrote:
    I want my money back its useless if u cant share anything with your friends.....
    You have a seriously limited imagination if you think the lack of one feature makes the device useless.

  • I got my iPhone 4S and I think I have a problem with it. Sound when locking and unlocking is quiet compared with other iPhone 4S. I compared it with others and really is a little quiet. Other people have confirmed it too. Other sounds may be better. No pr

    I got my iPhone 4S and I think I have a problem with it. Sound when locking and unlocking is quiet compared with other iPhone 4S. I compared it with others and really is a little quiet. Other people have confirmed it too. Other sounds may be better. No problem tones, watching videos. This problem or is it something normal?

    I have this problem too, but it is intermittent. Sometimes the lock/unlock volume will drop to barely-audible, even though in settings the volume slider hasn't changed. If I then move the volume slider, it fixes the problem and the lock sounds jump back to normal, but then later on the problem will happen again.

  • Readding and writing with currect enties of xml into config file?

    Hey dear Developers,
    i ask about xml file for config.xml.
    If you change line of config.xml than application air will to read sometimes xml structures...
    Example:
    <config>
    <app>
      <lang>langde</lang>
      <style>default</style>
    </app>
    </config>
    If i change to this:
    <config>
    <app>
      <lang>langen</lang>
      <style>default</style>
    </app>
    </config>
    Than Application Air will to load currect ..
    If you change with failure or problem...
    <config>
    <app>
      <lang>langen
      <style>default</style>
    </app>
    </config>
    What does it happen while you changed this failured enties of config.xml. When Application Air will to load error message or create again new xml file?
    I have been tried i have problem of my writeconfig():void ...
    Thanks can you help me ?

    Its likely that there is an ADF deployment listener that is adding the skeleton faces-config.xml to the web application because it did not find one in the project in the standard location. OJDeploy simply invokes the JDeveloper deployment in headless mode to an archive that is the same as what you would see when deploying to an archive from within the IDE. You can verify this by deploying the same module from within the JDEV IDE.
    You can either move your validator to the JDev standard location WEB-INF/faces-config.xml or use Ant to do your build entirely. (if you don't need JDev specific deployment behavior). If this does not work for you, you could open a bug to see if it is possible to stop JDev from generating the skeleton file.

  • Xml into war file

    How I can read an xml file with SAX or DOM into a war file?. I have WLS 6.1 SP4
    with WLI2.1 SP2.
    I can read a xml file, but when I create a war file, the aplication does not find
    the xml file. When it tries to find it, it looks on the path but not on the war
    which contains the xml file needed.
    This is the instruction given:
    String uri = "Menu.xml";
    DocumentBuilderFactory factory =DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse( uri );
    And the error message displayed is:
    File "file:///c:/bea/wli21/Memu.xml" not found
    Coments please!!
    Edy

    The error is calss org.xml.sa.SAXParseException: File "localhost:7001/Menu.xml"
    not found
    I change localhost by the correct IP.
    Tks.
    Edy
    "Karthik V" <[email protected]> wrote:
    What error message are you getting now?
    Can you produce the trace?
    Try using File or InputStream while Parsing.
    That will help you to narrow down the error.
    /k
    "Edith Barra" <[email protected]> wrote in message
    news:3ea594cc$[email protected]..
    The error persist.
    Help me!!
    Tks.
    Edy
    "Karthik V" <[email protected]> wrote:
    Try modifying your uri value to http://localhost:7001/Menu.xml
    Substitute correct port and docroot for the xml location.
    /k
    "Edith Barra" <[email protected]> wrote in message
    news:3ea572aa$[email protected]..
    How I can read an xml file with SAX or DOM into a war file?. I haveWLS
    6.1 SP4
    with WLI2.1 SP2.
    I can read a xml file, but when I create a war file, the aplicationdoes
    not find
    the xml file. When it tries to find it, it looks on the path but
    not
    on
    the war
    which contains the xml file needed.
    This is the instruction given:
    String uri = "Menu.xml";
    DocumentBuilderFactory factory =DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse( uri );
    And the error message displayed is:
    File "file:///c:/bea/wli21/Memu.xml" not found
    Coments please!!
    Edy

  • How to use OCR Font A type by the time of writing some text into Pdf fil

    Hi,
    I am generating one pdf file in java. How can I use OCR Font A for text of pdf file ..Please can any one help where can I get OCR Font A and how to use that one in java ... I want to write some text into pdf file and that text should use OCR Font A family ...
    Thanks.

    This document shows how to disable OCR during conversion; just do the opposite: https://forums.adobe.com/docs/DOC-3062

  • Writing chinese character into a file

    Hi,
    I need to write chinese characters into a file,I used FileOutputStream, using the method write(byte[] b)...
    whereby I will convert the chinese word into bytes....
    but it couldn't work...
    Please Help!!

    you can write the unicode hex string (e.g. 606D559C53D18D22 for Gong Xi Fa Chai) into a text file by using the following code
              PrintWriter out2 = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream("chinese_out.txt", false), "UTF-8")));
                   int countChineseChar = chineseHex.length()/4;
                   int index = 0;
                   String c = "";
                   int b;
                   for(int i=0; i<countChineseChar-1; i++)
                        c = new String(chineseHex.substring(index, index+4));
                        b = Integer.parseInt(c, 16);
                        out2.write(b);
                        index+=4;
    Note that the OutputStreamWriter uses the UTF-8 to encode the unicode hex. I'm assuming that the hex is fixed at 4 digits each character
    syam

  • How to writing the data into the file at the same frequency of data acquisition using myRIO

    Hi everyone,
    I have a question regarding data acquisition fequency and data recording frequency of myRIO. Hope you guys can help me out.
    Basically, I want to acquire voltage input at analog input 0 at the frequency of 1kHz and then write the data into a file (tdms format). 
    However, I always found there were only 55 or 56 data points recorded every second in the data file (see the excel sheet). 
    To confirm my data acquisition was performed at the correct frequency, I added a small function in the main loop to indicate the time spent between two acquisition events. 
    To my surprise, the period of data acquistion is correct (1ms or 1kHz) but there are only 55 or 56 data point per second recorded in the data file.
    How can I record every data point acquired by the analog input?
    Thank you!
    P.S. I am very new to myRIO. How can I manually set the system time for myRIO? The default time of my myRIO is wrong. 
    Best,
    Tengyang
    Attachments:
    test result.xlsx ‏16 KB
    Main with timed loop.vi ‏122 KB
    test result.xlsx ‏16 KB

    Have a look at the Jakarta POI project, they have a Java API for creating Word documents.
    http://jakarta.apache.org/poi/hwpf/index.html

  • Awm10202_win32.zip throws exception after import Product Other.XML

    I just downloaed awm10202_win32.zip and installed it.
    I also downloaded GLOBAL_AWM10g.zip.
    I launched Oracle Analytic Workspace Manager Version 10.2.0.2.0 and then tried to create PRODUCT dimension via 'Create Dimension From Template' from Product Other.XML (out of GLOBAL_AWM10g.zip 5,366KB), the import succeeded, however when I navigated to 'Mappings' under PRODUCT, I got a Error window popped up and here is the output after clicking 'More details':
    java.lang.ArrayIndexOutOfBoundsException
    at oracle.bali.ewt.model.ArrayTwoDModel.setData(Unknown Source)
    at oracle.bali.ewt.grid.hGrid.HArrayTwoDModel.setStoreData(Unknown Source)
    at oracle.bali.ewt.grid.hGrid.HArrayTwoDModel.setExpandedData(Unknown Source)
    at oracle.olap.awm.dataobject.dialog.modelview.Mapping.AbstractMappingPanel.setupHArrayDataSourceNew(AbstractMappingPanel.java:1747)
    at oracle.olap.awm.dataobject.dialog.modelview.Mapping.AbstractMappingPanel.setupHArrayDataSource(AbstractMappingPanel.java:1708)
    at oracle.olap.awm.dataobject.dialog.modelview.Mapping.AbstractMappingPanel.setupHArrayDataSourceNew(AbstractMappingPanel.java:1768)
    at oracle.olap.awm.dataobject.dialog.modelview.Mapping.AbstractMappingPanel.setupHArrayDataSource(AbstractMappingPanel.java:1708)
    at oracle.olap.awm.dataobject.dialog.modelview.Mapping.AbstractMappingPanel.setupHArrayDataSourceNew(AbstractMappingPanel.java:1768)
    at oracle.olap.awm.dataobject.dialog.modelview.Mapping.AbstractMappingPanel.setupHArrayDataSource(AbstractMappingPanel.java:1708)
    at oracle.olap.awm.dataobject.dialog.modelview.Mapping.AbstractMappingPanel.setupHArrayDataSourceNew(AbstractMappingPanel.java:1768)
    at oracle.olap.awm.dataobject.dialog.modelview.Mapping.AbstractMappingPanel.setupHArrayDataSource(AbstractMappingPanel.java:1708)
    at oracle.olap.awm.dataobject.dialog.modelview.Mapping.AbstractMappingPanel.convertToHArrayTwoDModel(AbstractMappingPanel.java:1702)
    at oracle.olap.awm.dataobject.dialog.modelview.dimension.DimMappingPanel.updateMappings(DimMappingPanel.java:511)
    at oracle.olap.awm.dataobject.dialog.modelview.dimension.DimMappingPanel.getMapsNew(DimMappingPanel.java:141)
    at oracle.olap.awm.dataobject.dialog.modelview.dimension.DimMappingPanel.getMaps(DimMappingPanel.java:133)
    at oracle.olap.awm.dataobject.dialog.modelview.Mapping.AbstractMappingPanel.initialiseFieldsFast(AbstractMappingPanel.java:175)
    at oracle.olap.awm.dataobject.dialog.modelview.dimension.DimMappingPanel.initialiseFieldsFast(DimMappingPanel.java:75)
    at oracle.olap.awm.dataobject.dialog.PropertyPanelHelper$1.run(PropertyPanelHelper.java:41)
    at oracle.olap.awm.util.MiscUtils.invokeInEventThreadAndWait(MiscUtils.java:418)
    at oracle.olap.awm.dataobject.dialog.PropertyPanelHelper.initialiseFieldsFast(PropertyPanelHelper.java:37)
    at oracle.olap.awm.dataobject.dialog.PropertyPanel.initialisePanel(PropertyPanel.java:412)
    at oracle.olap.awm.dataobject.dialog.PropertyViewer.initialiseFields(PropertyViewer.java:676)
    at oracle.olap.awm.dataobject.dialog.PropertyViewer.initialise(PropertyViewer.java:276)
    at oracle.olap.awm.dataobject.dialog.modelview.modeler.ModelPropertyViewer.initialise(ModelPropertyViewer.java:62)
    at oracle.olap.awm.app.AwmFrame.selectionChanged(AwmFrame.java:4156)
    at oracle.olap.awm.navigator.Navigator.fireNavigatorEvent(Navigator.java:149)
    at oracle.olap.awm.navigator.Navigator.propertyChange(Navigator.java:129)
    at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(Unknown Source)
    at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(Unknown Source)
    at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(Unknown Source)
    at javax.swing.JComponent.firePropertyChange(Unknown Source)
    at oracle.bali.ewt.dTree.DTree.firePropertyChange(Unknown Source)
    at oracle.bali.ewt.dTree.DTree$SelectionListener.propertyChange(Unknown Source)
    at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
    at oracle.bali.ewt.dTree.DTreeMultipleSelectionManager.firePropertyChange(Unknown Source)
    at oracle.bali.ewt.dTree.DTreeMultipleSelectionManager._setSelection(Unknown Source)
    at oracle.bali.ewt.dTree.DTreeMultipleSelectionManager.selectItem(Unknown Source)
    at oracle.bali.ewt.dTree.DTree._updateSelection(Unknown Source)
    at oracle.bali.ewt.dTree.DTree._handleMouseSelection(Unknown Source)
    at oracle.bali.ewt.dTree.DTree.processMouseEvent(Unknown Source)
    at oracle.olap.awm.navigator.Navigator.processMouseEvent(Navigator.java:509)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at oracle.bali.ewt.LWComponent.processEventImpl(Unknown Source)
    at oracle.bali.ewt.dTree.DTree.processEventImpl(Unknown Source)
    at oracle.bali.ewt.LWComponent.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Does anyone have similar experience? and how do you work around it?

    I just pulled the same file today, from the OTN > BIDW > OBExample page. And got exactly the same error. Not surprising, since all the XML definition files in that zip date back to March 2005.
    There are two other definition files, that may or may not work.
    - The "Product Star" file uses the PRODUCT_DIM table, instead of the denormalized tables.
    - The "Product Unmapped" file sets up the same dimension / hierarchy / attributes, but does not map it to the tables. Leaving that for you to do (hopefully without issues).
    You may have problems deleting the existing Product dimension though.
    And so you might just have to scrap the whole Workspace and start from scratch.
    ---- best that I could find, good luck to others ---
    NOTE TO PMs >>> could you look into this and post a definitive fix / change the OBE instructions. thanks

  • Xml bean with other Xml Bean

    Is there a way to make two set's of generated java classes from the same schema
    to work together?
    I generated two sets of java classes using scomp. one set with xsdConfig and the
    other without.
    I got two sets of java classes that are mapped to the same schema.
    when I am trying to pass the same string of the first Document class as an argument
    and to the second Document parser I am getting a class cast exception on the second
    one.
    // example
    RootDoc1 doc1 = RootDoc1.Factory.parse("a valid xml string");
    RootDoc2 doc2 = RootDoc2.Factory.parse("same xml string here"); <= couse a class
    cast exception because it returns a RoodDoc1 type.

    why nobody helping me
    pls help me
    i am stucked with type mapping error?

  • I got the image on the vi,now I want to take rectangle potion from that image and compare with other image

    Hi,
    Now i have a image on VI ,i want to take rectangale postion of the image and compare with the other image(In this image also i need to take a small postionof it) and  show the result.
    Both image are equal or not....if it is equal show pass if the image is not ok fail.
    Regards,
    Sri.

    First i would like to thanks for the inputs,
    I have made one Vi for comparing the two images and display  equal or not.
    Problem:if there is a small change in the picture it is showing false ,but the image is ok only the contract ,clarity ,inclination is the problem... i need your help in controlling that image......like controlling the colors and telling if the color , shade, projection of the image of the image is in between this range show it as ok....
    i started with cluster taking the out put of the BMP file, but i am not able to do....can u help me on this.
    i am attaching the file what i have made...
    Regards,
    Sri
    Color
    Attachments:
    image.ppt ‏52 KB

Maybe you are looking for