generated writing XML to a file after comparing with other XML

Hello

I made the comparison of the two XML now, I have an obligation to concat these two xml but also necessary to add the XML code with a status node that is after comparing the two displayed XML is Y or N, so if it is there then a node with

< status > Y < / status >

< of table > t1 < / table >

then by completing the tasks that I have to write to a file

declare

p_emp_info CLOB.

l_emp_tab xmlsequencetype: = xmlsequencetype();

BEGIN

I'm IN (SELECT id from emp WHERE emp_name = 'ABC') LOOP

l_emp_tab.extend;

SELECT XMLELEMENT ("ABCD",

XmlElement ("ID", i.ID))

IN l_emp_tab (i)

FROM dual;

END LOOP;

SELECT XMLELEMENT ("EMP"

XMLAGG (t.column_value))

IN p_emp_info

TABLE (l_emp_tab) t;

-Dbms_Output.put_line (getclobval (1,2));

EXCEPTION

WHILE OTHERS THEN

Dbms_Output.put_line(SQLCODE||) SQLERRM);

END;

I'm using this query, but it gives me an error that the expression is of the wrong type on this line {IN l_emp_tab (I)}

I am unable to find the error what I'm missing here!

You have changed the data type of I the example that Odie that gave you in

repeating nodes using loop but when XML string concating then concating only last iteration of the loop FOr?

In his case, I was a number.  In your code above, I have now is the set of rows in a cursor.

You can 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 use the % c_info number of LINES in the INTO clause, hence the l_pos.

Or you can rewrite 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 file.

Tags: Oracle Development

Similar Questions

  • Import data from the .tdms file and comparing with the measured .tdms file

    Greetings,
    I want to make an application that writes the values measured in a .tdms file.
    But I want to do a separate database in a .tdms file that contains the theoretical values.
    After the measurement, the application must compare the measured values with the theoretical.
    If the application needs to read that a cell of the .tdms file.
    Is this possible?

    Thank you

    Here are some materials:

    http://www.NI.com/white-paper/3727/en

    http://www.NI.com/white-paper/5696/en

    I also recommend that you can start with examples of PDM in LV to get acquainted.

  • How to remove files after synchronization with PC

    After syncing, I tried to delete some unnecessary files and bookmarks. I can't delete files even if they are empty. Bookmarks are deleted very well.

    Hello

    Thank you for your question about better management of bookmarks in Firefox for Android.

    Bookmark management is examined, but a delivery date is currently unknown. Follow the Blog from Firefox for updates about the other new features of Firefox.

  • Is it safe to delete the zipped files after unpacking with success in the stage space?

    Hi all

    I was able successfully decompress the files in the stage_R12 area.

    Is it safe to remove files zipped now after decompress?

    Just for the sake of space...

    4 directories have been created:

    EBSINSTALLMEDIA

    startCD

    TechInstallMedia

    TechPatches

    Thank you

    If the installation completed successfully, you can delete the staging area if you do not expect to run any installed more

  • Save for web images look slightly blurry compared to other images that I see online

    Whenever I save a file in photoshop for the web as a png image, I see them get a little blurry and not very sharp. I did all the dimensioning and sampling etc. as far as I know. Yet, when I compared with other images that I see online, they don't look as strong. Is it just a fact that I need to add to my work, even if a large part of the time I work with vector shapes? Are not vectors supposed to be clean and crisp always?

    The blue image below is another person I know was made in Photoshop. My work is the red on the right. As you can see, it looks a little blurry.

    comparison.png

    Any ideas or suggestions?

    The blue image was also created with more details in the foreground as sting in the Ribbon and more texture contours in the Ribbon.  That's why the Red Ribbon seems less detail and seems flat.  I don't see with my eyes less sharpness however the drop shadow and a low background noise in the Red image contrast color makes the Red image have less contrast and then the blue image with a high-contrast light blue background. The red background details are not clear I would like this or aim to have a look of sweet in the background. When there's no detail in the blue image background other maybe a bit degraded.  It has IMO a lot to do with the composition.

  • iTunes generates a XML file.

    iTunes generates a XML file.

    https://discussions.apple.com/message/28513383#28513383 - new with iTunes 12.2 setting preferably do not create .xml

  • How to create ViewObject to generate the xml file?

    Hello everyone...

    People, I would like to know if it is possible to create a ViewObject to generate an xml file.
    In other words, I have a database table and I need to generate an xml file based on this table.

    Someone has already done it?

    The ADF swing.
    JDeveloper Studio 11.1.1.4.0.

    Hello

    Try this link

    Generate the xml file based on the java oracle table using jdeveloper 10 g

  • How can I compare the differences between two files After Effects?

    I have a major problem.  I was working on special effects for a film.  In After Effects, when I change siggificant, I often have to register under and create a new name so I can go back to the old work if necessary.  It comes in a case, I have come back from earlier works.  If I use these two files After Effects allows you to create multiple clips of effects.  And I do not remember just where you look at it, it is better.  Does anyone know a good way to compare the differences between the files?

    One thing to keep this conversation on the right way: I know that I did a stupid thing.  I've never done this before so can we please not spend a lot of time on how to avoid this problem and stick to how we solve this problem?

    If you encounter difficulties to identify differences in the old and new versions, you can use this procedure:

    To avoid confusion, I'll call your former company and your most recent compositions CompB comps.

    CompA drag "New Comp" icon in the project window.  This will create a new temporary layout that contains the nested CompA.

    Drag in your new COMP CompB temporary ensure it aligns image for image with CompA.

    Place the top layer (CompB) difference.

    Now, when you play through the comp, you'll see differences in color at a time where the comparison and CompB are not identical.

  • Generate the XML FILE OF APEX

    Hello

    I want to generate an XML file from APEX when one click on the button as an example below
    and all the "BOLD" number I want to receive them as parameters.

    <? XML version = "1.0" standalone = 'no '? >
    <! DOCTYPE tags SYSTEM "label.dtd" >
    < labels _FORMAT = "1" >
    < _QUANTITY label = "" * 5 * ">"
    < variable name = "PARAMPRICE" > * 12.99* < / variable >
    < variable name = "NEWPRICE" > * 9.99* < / variable >
    < variable name = "SKU" > * 12345 * < / variable >
    < variable name = "COLOR" > * 010 * < / variable >
    < / label >
    < / Label >


    Thank you
    Jade

    Edited by: Jade04 May 21, 2009 12:21

    Jade:

    The steps are

    Create page 1 with a region with so many elements you want settings
    Create a button on page 1 that submits the page and branches to page 2
    Page 2 create one page with the following code processes before

    declare
    v_file_name   VARCHAR2 (2000) := 'Xmlfile.xml';
    begin
    OWA_UTIL.mime_header ('application/txt', FALSE);
    htp.p('Content-Disposition:attachment;filename="'|| v_file_name|| '"');
    OWA_UTIL.http_header_close;
    htp.p('
    
    
    
    
    
    ');
    apex_application.g_unrecoverable_error:=true;
    exception when others then
    null;
    end;
    

    CITY

  • Cannot save files Windows 7, sharing violation excel 2007 - have lost many hours of work that it corrupts the file, after it tried so-called recovered-the same file on the machine xp without problem.

    Cannot save files Windows 7, sharing violation excel 2007 - have lost many hours of work it corrupts files after he supposedly has found and tried the same (copied) files on the machine xp without problem. Also sometimes on the stand alone machine without network and excel files generated on this machine. Any thoughts?

    If you use Internet Security of Trend Micro with Windows 7, this combination is probably what is causing the problem.

    To fix this, open the main Trend Micro Internet Security (or similar). Open the Virus & Spyware controls. Choose the Protection against viruses & Spyware; Click settings, then advanced settings. Uncheck the box next to 'save files before you try to remove the virus '.

    This solved my save all problems in Excel 2007 and Word 2007.

  • Archives generate the different path compared with the path mentioned in LOG_ARCHIVE_DEST_1

    Hi all

    I have 2 Installation RAC + ASM from the node. Here, I found that generate the archives on the different path compared to the path mentioned in log_archive_dest_1.

    O/P to the list of archive logs:

    Database log modeFashion Archive
    Automatic archivingActivated
    Destination of archive+ ORAARCH

    Sequence of journal online oldest 2307

    Log sequence archive 2309

    Current log sequence2309

    Archives to generate the path are: (to 17 July 2015)

    + ORAARCH, ABCDB, ARCHIVELOG, 2015_07_17

    Please guide why such difference?

    Destination of archive + ORAARCH

    Above location is diskgroup name in ASM (OMF), all files created in the DISKGROUP/DBNAME/FILETYPE format.

    2015_07_17 is the DATE of generation of the Archive.

  • APEX 5 - problem with static files after Installation

    Hello

    I've updated my development environment of APEX 4.2.6 to 5.0.0 with REST Data Services.

    Whenever I enter the Administration Services login page or run my application, I get the following message:

    There are problems with the configuration of static files in your environment. Please see the section "Configuration static file Support" in the Guide of the Installation Application Express.

    In Administration Services everything looks and works very well, but in my application there is no static file from the workspace loaded (for example CSS-files, images,...). The links "broken" to these files are translated in this way:

    <link rel="stylesheet" href="lets/static-files-not-configured/files/static/v1Y/lets.css" type="text/css">
    

    After some research, I discovered, that static files normally appear in my workspace in the Administration Services - I can access it and download it. BUT: When I compared the scheme with APEX_050000 APEX_040200 in the database, I discovered, that static files were not copied to the new instance (in the view APEX_WORKSPACE_FILES are just a few files...).

    Does anyone have an idea what the reason would be so?

    Thank you

    Christian

    Hi Christian Klingbacher,.

    I've updated my development environment of APEX 4.2.6 to 5.0.0 with REST Data Services.

    Whenever I enter the Administration Services login page or run my application, I get the following message:

    There are problems with the configuration of static files in your environment. Please see the section "Configuration static file Support" in the Guide of the Installation Application Express.

    In Administration Services everything looks and works very well, but in my application there is no static file from the workspace loaded (for example CSS-files, images,...).

    • You have configured the RESTful Services during the installation of Oracle APEX?

    Reference: https://docs.oracle.com/cd/E59726_01/install.50/e39144/listener.htm#HTMIG29335

    Reference: http://docs.oracle.com/cd/E37099_01/doc.20/e25066/install.htm#AELIG7217

    The file Support static configuration to demand Express Installation Guide (using ORDS) says:

    RESTful Services configuration is necessary when upgrading to Oracle Application Express version 5.0 and RESTful Services were not configured in a previous version.


    See the thread with the same question: How to configure * application and the workspace of static files after upgrade from 4.2 to 5.0?

    I hope this helps!


    Kind regards

    Kiran

  • SQL query to generate nested XML data

    Hello
    I use Oracle 11 g R2 SOE...

    I have two main tables

    COMMERCIALS_PROPERTIES (PK, com_id, com_size, project number, com_type number number number)
    COM_PHOTOS (PK ID number, number com_id FK, content mimetype varchar2, blob)

    Please, note that the following has nothing to do with my problem:
    CONTENT and mimetype columns. In addition, the tables of research: PROJECTS, COM_TYPE

    Apex (Application Express) we can expose a report as a RESTful web service in XML format:

    I use this query to generate the XML 1 feed, but I need to change the query to generate flow XML 2 .

    How is this possible?
     Select
          
    "COM"."COM_ID" as "COM_ID",
    "COM"."COM_SIZE" as "SIZE",
    "PROJECTS"."PROJECT_NAME_EN" as "PROJECT",
    "COM_TYPES"."COM_TYPE" as "COM_TYPE",
    
    'http://fam-erp.com/apex/erp/fateh/'||IMG.ID as "ImgURL"
    
     FROM 
    COM_PHOTOS IMG inner join COMMERCIALS_PROPERTIES "COM"
    on   IMG.COM_ID = COM.COM_ID
    inner join "PROJECTS" "PROJECTS" 
    on "PROJECTS"."PROJECT_ID"="COM"."PROJECT_ID"
    inner join "COM_TYPE_LOOKUP" "COM_TYPES" 
    on "COM_TYPES"."TYPE_ID"="COM"."COM_TYPE"
         
     WHERE
      COM.COM_ID < 80 order by 1
    H1. XML 1
    H2. Please look only < COM_ID > and < ImgURL >
    <ROWSET>
    <ROW>
    <COM_ID>77</COM_ID>
    <SIZE>842</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1410</ImgURL>
    </ROW>
    
    <ROW>
    <COM_ID>77</COM_ID>
    <SIZE>842</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1412</ImgURL>
    </ROW>
    
    <ROW>
    <COM_ID>78</COM_ID>
    <SIZE>756</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1425</ImgURL>
    </ROW>
    
    <ROW>
    <COM_ID>78</COM_ID>
    <SIZE>756</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1429</ImgURL>
    </ROW>
    
    </ROWSET>
    ---------------------------
    H1. XML 2
    H2. Please look only < COM_ID > and < Images > and < ImgURL >
    <ROWSET>
    <ROW>
    <COM_ID>77</COM_ID>
    <SIZE>842</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <Images>
          <ImgURL>http://fam-erp.com/apex/erp/fateh/1410</ImgURL>
          <ImgURL>http://fam-erp.com/apex/erp/fateh/1412</ImgURL>
    </Images>
    </ROW>
    
    <ROW>
    <COM_ID>78</COM_ID>
    <SIZE>756</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <Images>
            <ImgURL>http://fam-erp.com/apex/erp/fateh/1425</ImgURL>
            <ImgURL>http://fam-erp.com/apex/erp/fateh/1429</ImgURL>
    </Images>
    </ROW>
    </ROWSET>
    
     

    Hi, Fateh

    One possible way is to use the XML features to create your XML file.
    Using XML, you can make the IMAGES as a subquery XMLAGG rather than join at the table of the image.

    Here is an example of the use of schema SCOTT:

    SQL> select xmlelement(
      2            "ROWSET"
      3          , xmlagg(
      4               xmlelement(
      5                  "ROW"
      6                , xmlforest(
      7                     d.deptno as "ID"
      8                   , d.dname as "NAME"
      9                   , (
     10                        select xmlagg(
     11                                  xmlelement(
     12                                     "ImgUrl"
     13                                   , 'http://the.server.com/'||e.empno
     14                                  )
     15                                  order by e.empno
     16                               )
     17                          from scott.emp e
     18                         where e.deptno = d.deptno
     19                     ) as "Images"
     20                  )
     21               )
     22               order by d.deptno
     23            )
     24         ) the_xml
     25    from scott.dept d
     26    /* joins to the other tables EXCEPT image table */
     27  /
    
    THE_XML
    --------------------------------------------------------------------------------
    10ACCOUNTINGhttp://the.server
    

    The output is an XMLTYPE column (think of it as a CLOB with addition of feature ;-))
    My SQL * PLUS the output of cuts, but believe me, it's all there.
    Just to show, here is the same example, wrapped in a function XMLSERIALIZE to print the XML file:

    SQL> select xmlserialize(
      2            content
      3            xmlelement(
      4               "ROWSET"
      5             , xmlagg(
      6                  xmlelement(
      7                     "ROW"
      8                   , xmlforest(
      9                        d.deptno as "ID"
     10                      , d.dname as "NAME"
     11                      , (
     12                           select xmlagg(
     13                                     xmlelement(
     14                                        "ImgUrl"
     15                                      , 'http://the.server.com/'||e.empno
     16                                     )
     17                                     order by e.empno
     18                                  )
     19                             from scott.emp e
     20                            where e.deptno = d.deptno
     21                        ) as "Images"
     22                     )
     23                  )
     24                  order by d.deptno
     25               )
     26            )
     27            as varchar2(4000)
     28            indent size=2
     29         ) the_xml
     30    from scott.dept d
     31    /* joins to the other tables EXCEPT image table */
     32  /
    
    THE_XML
    --------------------------------------------------------------------------------
    
      
        10
        ACCOUNTING
        
          http://the.server.com/7782
          http://the.server.com/7839
          http://the.server.com/7934
        
      
      
        20
        RESEARCH
        
          http://the.server.com/7369
          http://the.server.com/7566
          http://the.server.com/7788
          http://the.server.com/7876
          http://the.server.com/7902
        
      
      
        30
        SALES
        
          http://the.server.com/7499
          http://the.server.com/7521
          http://the.server.com/7654
          http://the.server.com/7698
          http://the.server.com/7844
          http://the.server.com/7900
        
      
      
        40
        OPERATIONS
      
    
    

    For a Web service you don't need to print the XML that is returned by the Web service.

    I do not know APEX, so I don't know if APEX supports exposing an already built piece of XML, rather than expose a query result.
    But my guess is that it should do very well if you ask an XMLTYPE data type (i.e. - to use the first of my examples, and not automatically printed.)

    If you do not have APEX to do it this way, then I suggest that you try asking in the APEX forum rather than the SQL forum ;-)

  • When I use the mail merge with excel file, after I press ok the progress bar indicates "NaN", mail project window crashes. My record is nice little CVS n

    When I use the mail merge with excel file, after I press ok of the progress bar indicates "NaN", mail project window crashes. My file is in the correct format and small size (4-column 4 raws). I use an English version of thunderbird after accidentally, I installed one in my tongue.

    I am attaching the screenshot

    I solved the problem
    has been st@pid excel

    I created a CSV file in openoffice calculator and everything went smoothly

  • Change the location of saved. ITL file after transfer

    Hello

    I just finished the rather painful process of migration of my iTunes library from my old PC to a new MacBook Pro.

    In summary:

    1. ITunes media folder. ITL file etc. was in a portable State on a hard drive external. Later transfer to the new Mac, it's still intend to keep the folder iTunes media external hard disk and connect via the USB port because of the size of my library.

    2. After discussion with the Apple today I had to drag the. ITL file on the desktop to open it with iTunes as the external hard drive has locked the file because of a problem in good shape on the external hard drive. Once transferred to the privileges of office has been modified and the file installed. This opens the library that I had saved before transfer to the Mac and when I then entered on the Options tab Advanced preferences and indicated the location of the support on the hard drive folder, iTunes began to organize my files, keeping them on the hard drive where I wanted to.

    So far so good, however need to clean things up a bit and I have noticed some problems and I was hoping someone may be able to help?

    BC. ITL file is now save on my desktop, and album artwork, iTunes genius media library of the (empty), iTunes folder etc.

    Multimedia content is located on the external HARD drive when I want him to stay and it is correctly indicated. I guess it's something to do with the fact that I have loaded the. File ITL of my office through the 'Alt Hold, open iTUnes, select the file".

    B. I want the. ITL file etc to save the standard position on my MAC in the music folder with other files from the library and not be on my desk. The music on the Mac folder already contains an old. ITL file and the files that had been initially tried because of problems of transfer of the library from scratch and I now need to do away with these.

    Sorry if it's a bit lengthy but wanted to paint a complete picture.

    In summary, what am I therefore seeks to achieve?

    1. the files that are currently save to the desktop. ITL etc. will now save in their suitable location on the MAC, crush the obsolete files that are in the folder music on Mac and are not necessary. I tried to drag these to a new location, however when I boot iTunes again, it creates a new set of files on the desktop.

    2. multimedia content remains on the disk external DRIVE where it is currently pointing, and I guess that no further action is required?

    Fortunately no more moves will be necessary during a period of long date, (I hope)

    Appreciate ate your help people

    SImon.

    Read all the iTunes files and their standard organization:

    On the iTunes library files - https://support.apple.com/HT201610 - does not mention that a complete library of work also includes other files and also files in the iTunes folder.

    More about the library files iTunes and what they do - http://en.wikipedia.org/wiki/ITunes#Media_management

    What are all these files in iTunes? - http://www.macworld.com/article/139974/2009/04/itunes_files.html

    Where are my iTunes files located? - http://support.apple.com/kb/ht1391

    iTunes 9 [and later]: understanding iTunes Media organization - http://support.apple.com/HT201979 - more information on the Organization of the new structure https://discussions.apple.com/message/26404702#26404702

    You can get back in the correct directory, then re - structure start iTunes with the option key method and that it points to the library file in your new organization.  She still needs to use media on the external hard drive. However, this reader concerns me.  If you used with a PC you probably used the disk to NTFS. iTunes will be able to read these files, but will not be able to modify them if you try to change track to a file on that drive information.

Maybe you are looking for

  • Extend the life of my battery

    Took my laptop out of its adapter for the first time tonight. I was amazed that after 90 minutes, it was still in the power of 83%.  If it is anywhere near a linear decrease in power, this battery will last very long before needing to be recharged. N

  • triaxial accelerometer

    Hola, buenas tardes, requiero connect a Triaxial sensor 256 has 01 piezoelectronics, don't con el device nor ubs 6009, pero no tengo idea of como is conecta said sensor has the fuente poder, ago that trae several conexiones y cual are no. para cada u

  • PC is a pause, click 3 times, runs 5 seconds and then repeat

    original title: PC BREAKS, CLICKS 3 TIMES, OPERATED 5 SECONDS AND THEN REPEAT XP OPERATING SYSTEM... PC STOPS, CLICK 3 TIMES, RUNS 5 SECONDS AND THEN REPEAT SEQUENCE. DO I HAVE A VIRUS OR ANOTHER ANIMAL?  NEVER MET HIM THIS BEFORE. Help, please!

  • I received a phone call from someone claiming that I had a virus

    I received a phone call from the India, claiming I had a virus, and it seems that I do... I followed the steps, they gave me, but I was unable to give them remote access to my computer (IE; take control). I found out because it is a scam. As they wer

  • Too short password on 1.0.9, can not unlock

    Can not unlock the alpha development after the new update, my password was missing previously and is not accepted now do not know if I should go out 10 max testing and wipe or wait for a solution.