Using XML to merge data
I have two xml documents:
Xml1.XML
< root >
< standardCosts period = "15 may" siteNumber "002" = >
< wheyCreamStandardCost > 2,655 < / wheyCreamStandardCost >
< / standardCosts >
< standardCosts period = "15 may" siteNumber "999" = >
< wheyCreamStandardCost > 1.35 < / wheyCreamStandardCost >
< / standardCosts >
< / root >
xml2.doc
< root >
< standardCosts period = "15 may" siteNumber "002" = >
< wheyCreamStandardCost > 3,00 < / wheyCreamStandardCost >
< / standardCosts >
< standardCosts period = "15 may" siteNumber '051' = >
< wheyCreamStandardCost > 2,655 < / wheyCreamStandardCost >
< / standardCosts >
< / root >
I want to merge xml2.doc on xml1.doc, using the tag attributes period / siteNumber as keys to produce the following XML
< root >
< standardCosts period = "15 may" siteNumber "002" = >
< wheyCreamStandardCost > 3,00 < / wheyCreamStandardCost >
< / standardCosts >
< standardCosts period = "15 may" siteNumber "999" = >
< wheyCreamStandardCost > 1.35 < / wheyCreamStandardCost >
< / standardCosts >
< standardCosts period = "15 may" siteNumber '051' = >
< wheyCreamStandardCost > 2,655 < / wheyCreamStandardCost >
< / standardCosts >
< / root >
I'm not sure how to proceed. Any ideas?
Here is a first approach based on a game, using a FULL OUTER JOIN:
SQL> declare 2 3 doc1 xmltype := xmltype('4 '); 11 12 doc2 xmltype := xmltype('5 72.655 68 101.35 913 '); 20 21 begin 22 23 with tmp_target (key1, key2, xmlcontent) as ( 24 select * 25 from xmltable('/root/standardCosts' 26 passing doc1 27 columns period varchar2(30) path '@period' 28 , siteNumber varchar2(3) path '@siteNumber' 29 , standardCosts xmltype path '.' 30 ) 31 ), 32 tmp_source (key1, key2, xmlcontent) as ( 33 select * 34 from xmltable('/root/standardCosts' 35 passing doc2 36 columns period varchar2(30) path '@period' 37 , siteNumber varchar2(3) path '@siteNumber' 38 , standardCosts xmltype path '.' 39 ) 40 ) 41 select xmlelement("root" 42 , xmlagg(nvl(s.xmlcontent, t.xmlcontent)) 43 ) 44 into doc1 45 from tmp_target t 46 full outer join tmp_source s 47 using (key1, key2) 48 ; 49 50 dbms_output.put_line(doc1.getclobval(1,2)); 51 52 end; 53 /14 163.00 1517 192.655 18PL/SQL procedure successfully completed. 3.00 2.655 1.35
Tags: Oracle Development
Similar Questions
-
Extract XML data using XML table NULL recovery
Hello
I use XMLtable to recover data using XMLtable
XML
"< env:Envelope xmlns:env = ' http://schemas.xmlsoap.org/SOAP/envelope/ ">
< env:Header > < / env:Header >
< env:Body >
" < = Xmlns:ns1 CreditBureauResponse ' http://www.example.org "xmlns =" " http://www.example.org ">
< ns1:Body >
< ns1:MGResponse > & lt; MGResponse xmlns = "urn: crif - messagegateway:2006 - 08-23" > & lt; U2:AUE_RES xmlns:u2 = "urn: AUE" > & lt; U2:response > & lt; U2:CBApplicationId > 123456789 & lt; / u2:CBApplicationId > & lt; U2:ProviderApplicationNo > 123 & lt; / u2:ProviderApplicationNo > & lt; U2:PreviousPhase > D & lt; / u2:PreviousPhase > & lt; U2:ActualPhase > D & lt; / u2: ActualPhase > & lt; U2:ApplicationDeleted > 0 & lt; / u2:ApplicationDeleted > & lt; / u2:Response > & lt; / u2:AUE_RES > & lt; / MGResponse > < / ns1:MGResponse >
< / ns1:Body >
< / CreditBureauResponse >
< / env:Body >
"< / env:Envelope >.
I would like to know where I am going wrong
SELECT x1.*
OF tmp_xml_aue t.
XMLTABLE (XMLNAMESPACES ('http://schemas.xmlsoap.org/soap/envelope/"as"env","http://www.example.org"as 'ns1", default'http://www.example.org'), )
' / env:Envelope / env:Body / CreditBureauResponse' T.OBJECT_VALUE by the WAY
columns MGRESPONSE xmltype PATH "ns1:Body/ns1:MGResponse/text()") X 1,
XMLTABLE (XMLNAMESPACES ("urn: crif - messagegateway:2006 - 08-23' as"v1", default" urn: AUE' '), ' / MGResponse/AUE_RES ' PASSAGE xmltype (DBMS_XMLGEN.convert (X 1.) MGRESPONSE. GETCLOBVAL(), 1))
columns CBAPPLICATIONID varchar2 (15) WAY "response/CBApplicationId.
) X 2;
Hello
I saw your question and I hope that the link below will help you solve your solution:
https://Oracle-base.com/articles/Misc/XMLTable-query-XML-data-from-SQL
If there are problems more made me know I'll like you the exact solution for your query.
Kind regards
Vinoth.
-
How to store data instead of memoryengine to the database when using XML file
Hi Experts,
I doubt that in XML for transferring data from the database.
Transfer of data from XML to the database tables will be store in memory for xml files, my goal is instead stored in the memory table engine
is it possible to store the data in the database itself...
I guess that when the size of the data increases say for example given huge amount, store as much data is the big issue here on the right, so to avoid this, is it possible to store
These data directly in the database level.
Please understand my requirement, either I have the explanation regarding my requirement and please help me how to do this job...
THX,
Sara.Remove the dp_doc = option Y of your url. It removes the schema whenever a new connection is created.
If you don't want to truncate the tables, I think you should also add the option dp_tbl = N.Kind regards
JeromeFr -
Data merge: data under a title of shared section grouping
I'm a total newb using merge data in indesign. I watched the video "Automating a catalog with data merge" and found very useful. I created a catalog for an auto parts company, so I have a file csv with a field for the brand, model, year range, part number. I use Make as a header and other information below. I don't want no repetition of brand (Honda) again and again.
Rather than:
Honda
Agreement of 2005-2010 part No. 4214-0100
Honda
Civic number 2005-2010 part 4214-0100
Honda
Odyssey 2005-2010 part No. 4214-0100
I would like it to appear:
Honda
Agreement of 2005-2010 part No. 4214-0100
Civic number 2005-2010 part 4214-0100
Odyssey 2005-2010 part No. 4214-0100
Can someone please give me some advice?
Thank you!
Although this can be easily accomplished in a data merge, it's probably not the right way (data fusion) to borrow in the production of a catalogue.
First suggestion: Catalog Plugin
Second suggestion: If the cost of the additional software is a problem, look in the XML workflow
-
Hi-
I made a new class for LabVIEW, and I try to save a file using XML. Attached pictures show how to create the file and how I read it, and I get the error message. I tried a variety of different methods and nothing worked so far. I was wondering if anyone had any advice or examples to save a class to file via XML.
In the meantime, I'll use the method described here:
http://forums.NI.com/NI/board/message?board.ID=170&message.ID=215511&query.ID=672786#M215511
but I would prefer XML for more usability later down the line.
I also thought just not related to the group all the data structure, recording via XML and then just group it upward and writing to an instance of the class. This seems to be more work that needs to be necessary and should be redone every time I have change the class.
Probably, it goes without saying that I am fairly new to LabVIEW so I hope this isn't a stupid error that is obvious to the vet...
Thanks in advance,
NateFirst - Sorry for wany waste of time to download the wrong screenshot in the op.
Second - I solved it! I was about to send a screenshot of my hierarchy for you to take a look at, but that made me think. I re-arranged my hierarchy; This solves the problem.
Now, for all those who had the same problem (Error 1527):
The first screenshot is my original project hierarchy, which did not work.
The second is my hierarchy updated the project that solved the problem.
Thanks for your help!
-
Hello
IM only a beginner in oracle and I have recently started working with XML DB, I read on the XMLType storage models and I think that the structured storage is the best option for the project, our xml data is very structured and has a predictable structure.
I recorded a schema in oracle (im using XE for test purposes) and run this statement:
Start
DBMS_XMLSCHEMA. REGISTERSCHEMA (SCHEMAURL = > 'PRODUCTOS.xsd', SCHEMADOC = > ' <? xml version = "1.0" encoding = "UTF - 8"? >)
" < xs: Schema elementFormDefault ="qualified"xmlns: XS =" http://www.w3.org/2001/XMLSchema ">
< xs: element name = "LISTA_PRODUCTOS" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "PRODUCTO" maxOccurs = "unbounded" minOccurs = "1" >
< xs: complexType >
< xs: SEQUENCE >
< xs: ELEMENT type = "xs: String" name = "i" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "IT" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "quantity" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "Center" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "customer" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "concepto" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "descripcionProducto" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "espacioM2" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "important" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "marca" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "medida" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "modelo" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "package" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "pesoUnitario" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "price" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "reference" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "remolque" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = 'series' > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "UM" > < / xs: element >
< xs: ELEMENT type = "xs: String" name = "valorUnitario" > < / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< / xs: Schema > ', LOCAL = > true, GENTYPES = > true, GENBEAN = > false, GENTABLES = > true,
FORCE = > false, OWNER = > 'TEST');
commit;
end;
/
and automatically created objects:
LISTA_PRODUCTOS451_TAB (LISTA_PRODUCTOS448_T RELATIONAL OBJECT XMLtype STORAGE TYPE)
DESC LISTA_PRODUCTOS448_T-> PRODUCTO (type PRODUCTO450_COLL)DESC PRODUCTO450_COLL-> i ' VARCHAR2 (4000 TANK), THE VARCHAR2 (4000 CHAR), quantity VARCHAR2(4000 CHAR)... valorUnitario VARCHAR2 (4000 TANK).
If I run a select statement on LISTA_PRODUCTOS448_T (by selecting t.getClobVal () in LISTA_PRODUCTOS448_T t) I can see all the data xml, but im confused, I don't know if it is possible to run a traditional sql query and get the data as a simple recordset or if it is necessary to use the functions of XMLtype and procedures using the XPath syntax or something else. I mean why he created all of this?
And besides I don't know how to set the size of the memory of the LISTA_PRODUCTOS451_TAB table, if I try to insert 20 xml nodes in a row, it saves all 20 nodes in a single line and if I try to save 1000 select returns an ORA-06502: digital or value error: character string buffer too small.
Thanks in advance and sorry for my English.
Create a temporary table (or a regular table, but you will have to do the cleaning yourself at the end of the procedure):
create a table temporary global xmltype tmp_xml
binary XmlType securefile XML store;
In the SP, insert the incoming XML document.
Purpose of test, I'll use this simplified version:
1 ABC 10 X 1000234 2 ABC 10 Y 1000234 3 DEF 20 Z 1000234 Then you can use XQuery to access data:
SQL > select x.*
tmp_xml 2 t
3, xmltable)
4 ' / LISTA_PRODUCTOS/PRODUCT.
5 passage t.object_value
path number 6 columns article 'i '.
7 road of VARCHAR2 (3) of THIS 'it '.
8 road number amount 'amount '.
9 road to varchar2 (1) centro "centro".
10 road of varchar2 (30) client 'client '.
(11) x
12;
ARTICLE THIS AMOUNT CENTRO CLIENT
---------- --- ---------- ------ ------------------------------
1 ABC 10 X 1000234
2 ABC 10 Y 1000234
3 DEF 20 Z 1000234
-
Error trying to update the model XML using XML Publisher administrator
Hello people,
We are on R12.1.3
I changed a condition in a report and you try to download the new model XML using XML Publisher administrator.
When I click the button to apply, it is throwing an error "bad request".
Navigation: XML Publisher Admin > data definitions > query report
Click on the report name > click 'Update file', in addition to the data model > choose file > click Apply
I get the below error
Bad request
Your browser has requested that this server could not understand.
Now, I could not download a new model of XML.
I'm doing something wrong.
Kind regards
Kris
user10163762 wrote:
Thanks Eugen and Hussein.
The problem is not with the template.
It seems to be a problem in this particular case.
Transferred to another instance.
However once I run the program, I can't display the output as flashes and disappears from the window of the browser.
My colleague says, it's to do with the trusted site to download something from the browser.
Can you please guide me on how to solve this problem?
Thank you
Hussein
-
Generating PDF editable using XML Publisher
Hello
I'm trying to generate an editable pdf form of R12 using XML Publisher. I am able to generate my PDF and load some data to it, but whenever I generate the PDF, it turns out all of my read-only form fields. I tried to create the xdo.cfg file and place it in $XDO_TOP/resource by using the code below.
<config version="1.0.0" xmlns="http://xmlns.oracle.com/oxp/config/"> <!-- Properties --> <properties> <property name="all-fields-readonly-asis">true</property> </properties> </config>
After that, I had my rebound DBA simultaneous server manager, but it did not work. I don't know that if there is something else miss me. Any help would be appreciated.
Thanks in advance.
Daniel
So, I realized what my problem was. For some reason any my xdo.cfg file in $XDO_TOP/resource has not been read. Now, I tried putting in $OA_JRE_TOP/lib and it worked. Thanks for your help.
Daniel
-
Merge data, create duplicate lists
I have a csv with about 580 records database. I created a template with the correct fields in inDesign, loaded the csv file using merge data, then created the merged document. I have 580 announcements of something like the image below. If there is a symbol wandering in the database to csv, the cause, it does not reflect an error in a preview. In fact, all 580 records can be previewed, copied and pasted into another document, and displayed without error. Any suggestions on how to solve this problem would be appreciated.
Overview of data merge is known to be buggy and trigger all sorts of strange errors (even if it's not necessarily all problem here). The best advice is NEVER to use for several records/page mergers, or if you feel you must, CANCEL after use, then just merge and trust at your disposal.
If you used an extract and then went from there to merge directly, and the merger is not successful, you must make a model like the one you use will not work correctly. You can copy/paste in place to create the model of the former route.
-
Merge data into InDesign with Hebrew characters
InDesign CC 2014 on Windows 7 Ultimate
I had an Excel file which contains mainly in English, but has a few words of Hebrews here and there. I was unable to save as a CSV file retaining the Hebrew from Excel, so I downloaded Google leaves and downloaded in CSV.
When I open the CSV file in Notepad, it looks perfect with Hebrew, although if open in Excel the characters are distorted.
When it is used to merge data into InDesign, the Hebrew characters appear as such mutilated versions only displayed in Excel.
I use GREP to format the Hebrew characters.
I have a feeling that the problem is at the "save CSV" step, but I do not know how to remedy this.
Any help much appreciated.
Thank you
Ruth
Instead of changing the file extension, try saving the text with UTF-8 encoding.
Excel: Save as type > text (separator: tab) > Tools > Web Options > Encoding > Unicode UTF-8
-
AR: Journal Entries report convert to Excel using XML
Hi all
The customer asks to add a column and change the output to Excel format (using the XML publish) the standard report "AR: Journal Entries Report" whish is generated...
I know that the report calls another report called "Journal entries report - out" with a few parameters one of them is "P_LAYOUT_DESCRIPTION" which may be 1 of these values
Print account details, print details by category, print summary by account, print the summary by category
and each of them has a different layout
Now, I want to know
1 - the ability to add a column to this report (SPAWNED)
2 - the ability to translate the output as EXCEL, PDF, RTF (using XML Publisher)
I know that the steps of how convert a XML report using the definition of data and model, but the program laid 'Journal Entries report - Output' calls specific parameters and does not mention the name of the template that will be used or the type of the output model
as if I'm going to create 4 models for each presentation how to let the main report called the output report, which gives the correct model to be displayed
Best regards
AmirOf course I used it and I created for her many models with different layouts,
But the user needs this report especially :( -
Cannot merge data files in a spreadsheet on secure document
I created a form in Acrobat X Pro. The form was guaranteed first with a password to restrict editing, allowing just Fill-in form fields. Then save file by activating features enabled and save the file. Everything works Ok: cannot change the shape and allows me to record, but when I use merge data files into spreadsheet to export data, the exported CSV file is empty. Cannot export data. So I tried to remove the protection by password but received the following message:
You cannot change the security on this document because the document is signed or certified.
Can I do to solve this problem? No more was able to export the data or the deletion of protection.
Thank you.
The next time you add security, select the option 'Enable copying of text, images and other content' If you want to be able to export the form data.
As is the case, you should be able to "file > save a copy" and then remove the security.
-
How to merge data to work with Arabic text
I need to make use of the data merge tool for a project I'm working on, but it involves the creation of documents in English and Arabic. I created a CSV (with Excel and OpenOffice) with English and Arabic text in there, but when I use it as a Data Source, the English is fine, but comes from Arabic in lines, points mark or arbitrary characters. I have UK InDesign CS6 and also a test of InDesign ME CS6, but doesn't seem to work. Any help would be massively appreciated.
I have never tried to work with Arabic text, but my suspicion is that the problem lies in the data file, not necessarily in InDesign. I don't know how your data file has been created, but my instinct would be to record from Excel as Unicode text, if that's an option avaialable you. This should give you a tabs-delimited text file that keeps the characters in extensive ranges required for Arabic, I think.
-
Hello
Wonder kind knowledgeable people if you can help me with a question find/replace.I'm doing a fusion of data of book content in indesign, where my data merge file is a simple text csv file that is delimited by tabs. I have two things (almost like here) I would like to make to specific parts of the text, but do not know how to achieve this.
-First of all, I would like to preserve the words/phrases of form 'italic', but it's obviously lost in a csv file. Is there anyway that I can mark these words so a search/replace can make this italic of the word. Im hoping that there is a solution that looks something like this;
for example. Content of the book is 'the italics of the word needs to be adjusted.
Original content is modified to be "the word $Italic $ $ needs to be adjusted", so that a dollar sign encapsulates the word in italics.
Then I am able to merge data from the csv file and somehow make a search/replace words/phrases that are wrapped by the dollar sign. So, do a find/replace all the words/phrases that satisfy this condition and then apply italic to all the words between the dollar signs.-My other question is that I use the ' |' character in my text to determine paragraph separators. I then do a find/replace after you import the text to replace all occurrences of ' |' for the paragraph separator (a kind of symbol $, a representative character in the menu drop down to the right of the change to). It works fine, but I would like to make a "BOLD" format paragraph separator so that it can better distinguish the separation of text sections.
But this is different from my problem "italic" above, since I am trying to apply a "BOLD" format to the character "change to", rather than something that exists in my original csv.
Hope I think, but I'd be happy to provide you with screenshots etc. (when I get home at )
Best Rgds
Ltwo solutions.
for the solution of italics, I would say that the OP has answered his own question with one exception - do not use the symbols dollar, instead use = or another character that is not reserved by GREP.
the solution I would use for italics would be a GREP search once the merger completed. Take a look at the picture to see what I did.
the second solution: styles GREP.
This means that the text will have a paragraph style are entrusted to him. make a style and character called "BOLD" in this style, the only thing to change is located in basic character formats, set the bold font style. might even make the character another example cyan color is more easily strucure.
Then go to the paragraph style options, click on GREP styles and correspond to the following screengrab
the advantage with a GREP style is that once the vertical bar (|) is replaced, the GREP style bold is lost; and that means less post processing and not needing a second search of the text - it's all living.
-
Hello world
I'm having a problem with the ID to merge data.
I design our new luminaires A5 brochure for my Golf Club and I want to automate the process.
My excel spreadsheet is set up as follows (csv file)
Month 1st round January Game Monday 9 January 2012 Stroke and put Monday, January 16, 2012 Stableford-N/Pin 8 & 11 Monday, January 23, 2012 Stroke and Novelty 9 & 18 Monday, January 30, 2012 Stableford-N/Pin 8 & 11 When I use the fusion of data ID all that I get is the first line, i.e. January game, how can I get the information to follow?
Thanks in advance for any help.
Wali60
There are two aspects of the records in datamerge.
The first: merge files relates to the selection of what information from the data source you want to use in the merge. A line in your worksheet = a folder, and you can select all, one, or a range of records.
The second: records per Page of Document: single or multiple. This applies to the process after that ID fills the fields of variable. Each collection of data is considered to be a record, and a single record can be place on a single page. Or the number of records that are placed on a single page.
My question was in which records to merge , who, in your situation, one record could be selected, preventing any additional to merge records.
Further reflection... In which case all records has been selected and only a recording has been merged... A lot of times that the data source can contain a false character that prevents data merges does not happen. Inspect the raw .csv file and see if there is any alleged character. Also, try a file .txt for the data source.
Maybe you are looking for
-
How to select multiple cells at the same time?
Hello How to select multiple cells at the same time? What is the keyboard shortcut? Thank you to. Flo, a french guy.
-
nodes to call groups, should be simple!
Hiya, I am new to invoke nodes from today and I need default reset of a large group of objects at the end of my VI. I don't want to set different invoke nodes for each of them. Can I ask a refnum to a group of objects and how I would do? See you soon
-
FreeCell display now has a bunch of ace in the main body of the game.
FreeCell display now has a bunch of ace in the main body of the game. Tried of closing and reopening, restart the computer.Can move other cards on top of this stack As misplaced, but bunch not ace itself.
-
Problems printing with HP Photosmart Plus 209 PDF documents has
Sometimes, when I try to print PDF documents, one or two sheets will print then the printer will just stop. It turns on and the message window says something like "to avoid damage, use the button 'on' close ' my husband has this same printer and the
-
Intel USB 3.0 eXtensible Host Controller Driver is not compatible with Windows 8
"" I am currently running windows 7 and was about to upgrade to windows 8, but the upgrade of Windows 8 Wizard says that "Intel® USB 3.0 eXtensible Host Controller Driver is not compatible with Windows 8 '. Is there any solution for this? How to inst