Architecture for writing XML information to Oracle DB
Hi,
I wish to design a java application that reads in an XML string from an Oracle database, parses this string and based on the tag values, inserts data from this XML doc to three Oracle temporary tables.
I have the flexibility to either store the XML as a String or as a document in the Oracle database.
Can anyone recommend how a solution for the issue above can be implemented?
Thanks in advance.
Does anyone has some pointers or clues?
Similar Messages
-
Choosing between SAX & DOM & StringBuffer class for writing XML
Hii Javaties
I need to create a XML document from a swing application.
I need to store this xml in a file.
For writing XML which parser should i use SAX or DOM or should i go for StringBuffer class.I'm not aware of a way to use SAX to create an XML document. It is used to view the contents of an existing XML document or data that is well-structured.
That leaves you with a choice of DOM or StringBuffer. We cannot tell enought about what you are doing to know which is better. Each has some advantages and disadvantages.
StringBuffer:
+ less overhead
- no assistance in ensuring the validity of the result
+ greater control over layout of resulting document (how and when to indent)
- any control over layout must be done by you.
DOM (although this task is easier in JDOM)
- more overhead
- some learning curve
+ result is guaranteed to be valid XML.
+ there are pretty formatters to generate good looking results
- there may be layout choices that the standard pretty formatters cannot do
As an example, consider this part of the Document being created.
You want <name>John Doe</name>
With a StringBuffer, you can just add these pieces. With DOM, you need to:
1) create an Element named "name".
2) create a Text object with a value of "John Doe".
3) add the Text object as a child of the Element
4) add the Element to the parent
Having done the DOM version (also a JDOM version) several times, I have developed an XMLHelper class that has several static methods to make simple, common constructs.
It lets me do things like:
parent.addChild( XmlHelper.makeElement( "name", customerName ) );
So, the answer to your question is the same as many other questions: It depends.
Dave Patterson -
Hello all
There's a vast amount of information on the java.sun.com site about parsing XML files:
* creating DOM trees in memory from an XML file
* setting up event handlers to be called when an XML file is parsed
* transforming XML files using XSL.
However, I can find very little information anywhere about writing XML files in the first place! I'm already aware of two ways to do this:
(1) create a DOM in memory and write this to a file. If the data is large, though, this isn't feasible.
(2) just output the XML elements directly to some file as text. This doesn't take account of the encoding, or special characters, and the document is not necessarily then syntactically valid.
Is there some API which I haven't yet come across that is designed specifically for writing XML data to files? If it's built in to Java 2, then goodness knows how I've missed it all this time; if it's third-party, I'd be grateful for any links.
Thanks for your help
Rich FearnI know pastes can be horrible, but this is a working example which I find useful: SAX XML output ;)
import java.io.*;
// SAX classes.
import org.xml.sax.*;
import org.xml.sax.helpers.*;
//JAXP 1.1
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import javax.xml.transform.sax.*;
//AlphabetXMLOut(file, alphabets);
class AlphabetXMLOut {
public void run(){
try{
FileOutputStream fos = new FileOutputStream("output.xml");
PrintWriter out = new PrintWriter(fos);
StreamResult streamResult = new StreamResult(out);
// PrintWriter from a Servlet
//PrintWriter out = response.getWriter();
//StreamResult streamResult = new StreamResult(out);
SAXTransformerFactory tf = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
// SAX2.0 ContentHandler.
TransformerHandler hd = tf.newTransformerHandler();
Transformer serializer = hd.getTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING,"ISO-8859-1");
serializer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,"users.dtd");
serializer.setOutputProperty(OutputKeys.INDENT,"yes");
hd.setResult(streamResult);
hd.startDocument();
AttributesImpl atts = new AttributesImpl();
// USERS tag.
hd.startElement("","","USERS",atts);
// USER tags.
String[] id = {"PWD122","MX787","A4Q45"};
String[] type = {"customer","manager","employee"};
String[] desc = {"Tim@Home","Jack&Moud","John D'oe"};
for (int i=0;i<id.length;i++){
atts.clear();
atts.addAttribute("","","ID","CDATA",id);
atts.addAttribute("","","TYPE","CDATA",type[i]);
hd.startElement("","","USER",atts);
hd.characters(desc[i].toCharArray(),0,desc[i].length());
hd.endElement("","","USER");
hd.endElement("","","USERS");
hd.endDocument();
fos.close();
}catch (IOException e){
System.err.println ("Unable to write to file");
System.exit(-1);
}catch (TransformerConfigurationException tce){
System.err.println("Error in: TransformerConfigurationException");
}catch (SAXException spe) {
// Error generated by the parser
System.err.println("Error in: (SAXException");
// Use the contained exception, if any
Exception x = spe;
if (spe.getException() != null)
x = spe.getException();
x.printStackTrace();
-Hope this helps -
XML SCHEMA registration for XML TYPE (storing XML files in Oracle 10g)
I have created the XML Schema for the XML file stored in Oracle 10g and also added this Schema into the database. I have related that schema with the column in the table which contains the XML file. When i execute the query to fetch the data from the stored file i am getting a blank resultset. Is registering the XML Schema is necessary, if yes then please let me know the process of doing it. I have tried following steps to register Schema, but it is not working
Step1:
DECLARE
v_return BOOLEAN;
BEGIN
v_return := dbms_xdb.createFolder('/home/');
v_return := dbms_xdb.createFolder('/home/DEV/');
v_return := dbms_xdb.createFolder('/home/DEV/xsd/');
v_return := dbms_xdb.createFolder('/home/DEV/messages/');
v_return := dbms_xdb.createFolder('/home/DEV/employees/');
COMMIT;
END;
STEP 2:
Connecting To XML DB
Step3:
Register XML schema
I am failing to execute step number 2 and hence not able to register the schema also.<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by sudeepk:
If a java exception is thrown probably during ur install u might have forgotten
grant javauserpriv to scott;
grant javasyspriv to scott;
Thanks
[email protected]
<HR></BLOCKQUOTE>
Thank you!!! -
Need information on oracle certified security admin for solaris 10
Hi All,
I need some information on "oracle certified security admin for solaris 10 OS".The information what i am looking out is eligibility criteria and within oraganization any tranning provided .
Regards,
Uma Maheshwar.http://education.oracle.com
-
Confusion for writing Crawling Data to Which XML Methods?
Hi,
I am stucked over here as i m going to use XML.
Problem Having :-
I have implemented the Crawling code .
In which I have written the upcoming Main urls and and its sublinks in the Different Text File with the Incremented numbers.
But in the Text files i can't see each and every URl's Grand Parent ,Parent and Child Relations.
So, it generates the confusion and more time to see which URl having which Sublinks and its Text Files.
Thinkable Approxiamte Solution from my side
To use XML for Writing the Crawling processed all links Grant Parent, Parent and Child Relation Ships.
Which can be useful for Traversing all the links Parent and Child relation Ship into only 1 XML file.
XML files after that will used to read line by line and fetch the uRLs and that will used for other process ahead.
Question Having:
There are so many XML Methods available on the internet.(i.e. XMLwriting,XML Beans,Dom4j,XML Parser,SAX Parser,Dom Parser)
So which method should i used for reading and writing the Crawling Parent and Child Relation ship using Good Schema.?
Pls provide some code or useful links or any Suggetion which makes me to reach at solution.Use the Write Waveforms to File VI to write to a tab delimited text file. Excel can open those up just fine.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
What is the advent of writing xml mapping for servlet in tomcat4.1
what is the adventage of writing xml mappings for servlet in tomcat4.1? why dont we write in tomcat 3.1?
what is the adventage of writing xml mappings for
servlet in tomcat4.1? why dont we write in tomcat 3.1?Tomcat 3.1 doesn't support it because it was not a common practice then. Tomcat 4.1 deployments were made J2EE compliant. Mapping in XML has an advantage of having a proper DTD for validation, which would be known to all. It serves as a common standard irrespective of the server you use. -
Create and populate pdf forms from a xml file for follow up information
Forgive my amateurishness, I have a simple .xml that was created with excel with name, address, date of service, age, dob, account #, unit, and business name. I need a form to be pre-populated with the .xml data but have other fields (mainly Yes/No check boxes) that need to be populated by other users. This users would then finish filling out the form and return it to me via email. I have created the form in LC Designer ES2 and created it with Acrobat Pro X. However when I attempt to import data I can only see the first .xml record. So my question is, how do I create multiple .pdf forms for each .xml record? Do I need to use Java within LC Designer? Or use Adobe Pro? I am not afraid to attempt to code, (I have many excel programs that batch print to .pdf using vb).
Thank you in advanceTry the forum for LiveCycle Designer.
-
Create pdf forms from a xml file for follow up information
Forgive my amateurishness, I have a simple .xml that was created with excel with name, address, date of service, age, dob, account #, unit, and business name. I need a form to be pre-populated with the .xml data but have other fields (mainly Yes/No check boxes) that need to be populated by another user. This user would then finish filling out the form and return it to me via email. I have created the form in LC Designer ES2 and created it with Acrobat Pro X. However when I attempt to import data I can only see the first .xml record. So my question is, how do I create multiple .pdf forms for each .xml record? Do I need to use Java within LC Designer? Or use Adobe Pro? I am not afraid to attempt to code, (I have many excel programs that batch print to .pdf using vb).
Thank you in advanceI don't play with forms enough to give an answer. However, you might search the Forms sub-forum for a possible solution. You might also find better answers there, though many of the forms experts drop by here too.
-
Looking for an XML-enabled database system
Dear all,
I am looking for a RDBMS (Relational Database Management System) that provides management of XML data in a relational fashion.
I found the IBM DB 2 XML Extender. However, I am not sure if this system is already in use (because the latest release was in 2003).
I would be very grateful to you if you could help me to find what I am looking for.
PS. For RDBMS handling XML data, we find two categories: XML-enabled systems (they store XML data using a special data type like BLOB, CLOB,...), or the native XML systems (which stor XML data in its hierarchical structure, so the fundamental unit of storage is XML document). So, I precise that I am looking for an XML-enabled system and NOT a native XML system.
Thanks in advance.
Best regards,Thanks for your help,
To be more clear, I am looking for an XML-enabled database system (which provides only relational techniques to manage XML data).
Oracle is a Hybrid system (it means that it provides both native and relational fashions to manage XML data, e.g. you can store XML document as XMLType column (native way) or using BLOB data type (relational data type). I am collecting information about the three broad categories of XML database systems (native, XML-enabled, and Hybrid), and I would like to give example of each system. For example, there is BaseX and eXist-db for the first category (native systems), Oracle and IBM DB2 for the third category (each of theme manage XML data in both native and relational fashions). However, for the second category (XML-enabled systems), I don't find more information about the existing systems, there is for instance postgreSQL which is an XML-enabled system, but I don't find more information about its architecture, its XML data storage model, API for querying and updating, and so on.
Please don't hesitate to help me if you get some documentation about postgreSQL or about another XML-enabled database system.
Thank you again.
Best regards. -
Data Load from XML file to Oracle Table
Hi,
I am trying to load data from XML file to Oracle table using DBMS_XMLStore utility.I have performed the prerequisites like creating the directory from APPS user, grant read/write to directory, placing the data file on folder on apps tier, created a procedure ‘insertXML’ to load the data based on metalink note (Note ID: 396573.1 How to Insert XML by passing a file Instead of using Embedded XML). I am running the procedure thru below anonymous block to insert the data in the table.
Anonymous block
declare
begin
insertXML('XMLDIR', 'results.xml', 'employee_results');
end;
I am getting below error after running the anonymous block.
Error : ORA-22288: file or LOB operation FILEOPEN failed”
Cause : The operation attempted on the file or LOB failed.
Action: See the next error message in the error stack for more detailed
information. Also, verify that the file or LOB exists and that
the necessary privileges are set for the specified operation. If
the error still persists, report the error to the DBA.
I searched this error on metalink and found DOC ID 1556652.1 . I Ran the script provided in the document. PFA the script.
Also, attaching a document that list down the steps that I have followed.
Please check and let me know if I am missing something in the process. Please help to get this resolve.
Regards,
SankalpThanks Bashar for your prompt response.
I ran the insert statement but encountered error,below are the error details. statement.
Error report -
SQL Error: ORA-22288: file or LOB operation FILEOPEN failed
No such file or directory
ORA-06512: at "SYS.XMLTYPE", line 296
ORA-06512: at line 1
22288. 00000 - "file or LOB operation %s failed\n%s"
*Cause: The operation attempted on the file or LOB failed.
*Action: See the next error message in the error stack for more detailed
information. Also, verify that the file or LOB exists and that
the necessary privileges are set for the specified operation. If
the error still persists, report the error to the DBA.
INSERT statement I ran
INSERT INTO employee_results (USERNAME,FIRSTNAME,LASTNAME,STATUS)
SELECT *
FROM XMLTABLE('/Results/Users/User'
PASSING XMLTYPE(BFILENAME('XMLDIR', 'results.xml'),
NLS_CHARSET_ID('CHAR_CS'))
COLUMNS USERNAME NUMBER(4) PATH 'USERNAME',
FIRSTNAME VARCHAR2(10) PATH 'FIRSTNAME',
LASTNAME NUMBER(7,2) PATH 'LASTNAME',
STATUS VARCHAR2(14) PATH 'STATUS'
Regards,
Sankalp -
Create XML file from Oracle DB
Hi,
I'm working in a task to create electronic billing for Mexico Rules, to do this; I need to create a XML source that will contain all the information requested from Oracle DB.
For this reason, I'm looking how to create this XML file from Oracle DB.
All this is for the new legislations rules in Mexico to use electronic billing.
Please, if you have any reference about this, let me know.
Thanks and regards.you may want to check out commands like xmlforest and xmlelement
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions221.htm
copied from documentation
Purpose
XMLForest converts each of its argument parameters to XML, and then returns an XML fragment that is the concatenation of these converted arguments.
•If value_expr is a scalar expression, then you can omit the AS clause, and Oracle Database uses the column name as the element name.
•If value_expr is an object type or collection, then the AS clause is mandatory, and Oracle uses the specified c_alias as the enclosing tag. The c_alias can be up to 4000 characters.
•If value_expr is null, then no element is created for that value_expr.
Examples
The following example creates an Emp element for a subset of employees, with nested employee_id, last_name, and salary elements as the contents of Emp:
SELECT XMLELEMENT("Emp",
XMLFOREST(e.employee_id, e.last_name, e.salary))
"Emp Element"
FROM employees e WHERE employee_id = 204;
Emp Element
<Emp>
<EMPLOYEE_ID>204</EMPLOYEE_ID>
<LAST_NAME>Baer</LAST_NAME>
<SALARY>10000</SALARY>
</Emp> -
How to define data-sources-alias.xml to use Oracle data source
Hi,
I created Oracle jdbc Data Source named "MYDS" in Visual Admin. I added the alias = MYDS_ALIAS. I set the Initial Connection to 2. On the Monitor tab, I see a green line running across the screen. The datasource MYDS is connected to the Oracle.
Now, I would like to define "data-sources-alias.xml" to use MYDS.
When creating data-source-aliases.xml it creates the alias by default on ${com.sap.datasource.default} which is the default DB.
I followed the link --> How to point data-source-aliases.xml to another Datasource
and my data-sources-alias.xml is now:
<data-source-aliases>
<aliases>
<data-source-name>$</data-source-name>
<alias>BRANCH50DS</alias>
</aliases>
</data-source-aliases>
The "EAR generatation has finished successfully", but when "Deploy to J2EE Engine", I got the error below:
1) How to define data-sources-alias.xml to use Oracle data source?
2) I found the link (SDA Deployment error) talking about "sda-dd.xml". How to create "sda-dd.xml" and make it use substitution variables "MYDS"
Dec 20, 2005 3:53:41 PM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] INFO:
[003]Additional log information about the deployment
<!LOGHEADER[START]/>
<!HELP[Manual modification of the header may cause parsing problem!]/>
<!LOGGINGVERSION[1.5.3.7181 - 630_SP]/>
<!NAME[C:\usr\sap\J2E\JC00\SDM\program\log\sdmcl20051220205339.log]/>
<!PATTERN[sdmcl20051220205339.log]/>
<!FORMATTER[com.sap.tc.logging.TraceFormatter(%24d %s: %m)]/>
<!ENCODING[Cp1252]/>
<!LOGHEADER[END]/>
Dec 20, 2005 3:53:39 PM Info: -
Starting deployment -
Dec 20, 2005 3:53:39 PM Info: Loading selected archives...
Dec 20, 2005 3:53:39 PM Info: Loading archive 'C:\usr\sap\J2E\JC00\SDM\program\temp\temp856850022Ear.ear'
Dec 20, 2005 3:53:40 PM Info: Selected archives successfully loaded.
Dec 20, 2005 3:53:40 PM Info: Actions per selected component:
Dec 20, 2005 3:53:40 PM Info: Update: Selected development component '50022Ear'/'sap.com'/'localhost'/'2005.12.20.15.53.28' updates currently deployed development component '50022Ear'/'sap.com'/'localhost'/'2005.12.19.18.39.12'.
Dec 20, 2005 3:53:40 PM Info: Saved current Engine state.
Dec 20, 2005 3:53:40 PM Info: Error handling strategy: OnErrorStop
Dec 20, 2005 3:53:40 PM Info: Update strategy: UpdateAllVersions
Dec 20, 2005 3:53:40 PM Info: Starting: Update: Selected development component '50022Ear'/'sap.com'/'localhost'/'2005.12.20.15.53.28' updates currently deployed development component '50022Ear'/'sap.com'/'localhost'/'2005.12.19.18.39.12'.
Dec 20, 2005 3:53:40 PM Info: SDA to be deployed: C:\usr\sap\J2E\JC00\SDM\root\origin\sap.com\50022Ear\localhost\2005.12.20.15.53.28\temp856850022Ear.ear
Dec 20, 2005 3:53:40 PM Info: Software type of SDA: J2EE
Dec 20, 2005 3:53:40 PM Info: ***** Begin of SAP J2EE Engine Deployment (J2EE Application) *****
Dec 20, 2005 3:53:41 PM Info: Begin of log messages of the target system:
05/12/20 15:53:40 - ***********************************************************
05/12/20 15:53:41 - Start updating EAR file...
05/12/20 15:53:41 - start-up mode is lazy
05/12/20 15:53:41 - com.sap.engine.deploy.manager.MissingSubstitutionException: Missing substitution value for variable [MYDS].
at com.sap.engine.deploy.manager.DeployManagerImpl.makeTempEar(DeployManagerImpl.java:3727)
at com.sap.engine.deploy.manager.DeployManagerImpl.makeNewEar1(DeployManagerImpl.java:3695)
at com.sap.engine.deploy.manager.DeployManagerImpl.deployUpdateAction(DeployManagerImpl.java:523)
at com.sap.engine.deploy.manager.DeployManagerImpl.update(DeployManagerImpl.java:512)
at com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performDeployment(EngineApplOnlineDeployerImpl.java:196)
at com.sap.sdm.serverext.servertype.inqmy.extern.EngineDeployerImpl.deploy(EngineDeployerImpl.java:96)
at com.sap.sdm.serverext.servertype.inqmy.EngineProcessor.executeAction(EngineProcessor.java:224)
at com.sap.sdm.app.proc.deployment.impl.PhysicalDeploymentActionExecutor.execute(PhysicalDeploymentActionExecutor.java:60)
at com.sap.sdm.app.proc.deployment.impl.DeploymentActionImpl.execute(DeploymentActionImpl.java:186)
at com.sap.sdm.app.proc.deployment.controllers.internal.impl.DeploymentExecutorImpl.execute(DeploymentExecutorImpl.java:46)
at com.sap.sdm.app.proc.deployment.states.eventhandler.ExecuteDeploymentHandler.executeAction(ExecuteDeploymentHandler.java:83)
at com.sap.sdm.app.proc.deployment.states.eventhandler.ExecuteDeploymentHandler.handleEvent(ExecuteDeploymentHandler.java:60)
at com.sap.sdm.app.proc.deployment.states.StateBeforeNextDeployment.processEvent(StateBeforeNextDeployment.java:127)
at com.sap.sdm.app.proc.deployment.states.InstContext.processEventServerSide(InstContext.java:73)
at com.sap.sdm.app.proc.deployment.states.InstContext.processEvent(InstContext.java:59)
at com.sap.sdm.app.sequential.deployment.impl.DeployerImpl.doPhysicalDeployment(DeployerImpl.java:127)
at com.sap.sdm.app.sequential.deployment.impl.DeployerImpl.deploy(DeployerImpl.java:96)
at com.sap.sdm.apiimpl.local.DeployProcessorImpl.deploy(DeployProcessorImpl.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sap.sdm.is.cs.remoteproxy.server.impl.RemoteProxyServerImpl.requestRemoteCall(RemoteProxyServerImpl.java:127)
at com.sap.sdm.is.cs.remoteproxy.server.impl.RemoteProxyServerImpl.process(RemoteProxyServerImpl.java:38)
at com.sap.sdm.apiimpl.remote.server.ApiClientRoleCmdProcessor.process(ApiClientRoleCmdProcessor.java:81)
at com.sap.sdm.is.cs.session.server.SessionCmdProcessor.process(SessionCmdProcessor.java:67)
at com.sap.sdm.is.cs.cmd.server.CmdServer.execCommand(CmdServer.java:76)
at com.sap.sdm.client_server.launch.ServerLauncher$ConnectionHandlerImpl.handle(ServerLauncher.java:280)
at com.sap.sdm.is.cs.ncserver.NetCommServer.serve(NetCommServer.java:43)
at com.sap.sdm.is.cs.ncwrapper.impl.ServiceWrapper.serve(ServiceWrapper.java:39)
at com.sap.bc.cts.tp.net.Worker.run(Worker.java:50)
at java.lang.Thread.run(Thread.java:534)
05/12/20 15:53:41 - ***********************************************************
Dec 20, 2005 3:53:41 PM Info: End of log messages of the target system.
Dec 20, 2005 3:53:41 PM Info: ***** End of SAP J2EE Engine Deployment (J2EE Application) *****
Dec 20, 2005 3:53:41 PM Error: Aborted: development component '50022Ear'/'sap.com'/'localhost'/'2005.12.20.15.53.28':
Caught exception during application deployment from SAP J2EE Engine's deploy API:
com.sap.engine.deploy.manager.MissingSubstitutionException: Missing substitution value for variable [MYDS].
(message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).DMEXC)
Dec 20, 2005 3:53:41 PM Info: J2EE Engine is in same state (online/offline) as it has been before this deployment process.
Dec 20, 2005 3:53:41 PM Error: -
At least one of the Deployments failed -Hi,
If you remove the $ and braces (as shown below) it will work.
<data-source-aliases>
<aliases>
<data-source-name>MYDS</data-source-name>
<alias>BRANCH50DS</alias>
</aliases>
</data-source-aliases>
Regards,
S.Divakar -
Multi-level nested tables for repeatable XML Elements
Hi there,
Suppose we have a XML Schema „ASchema“ like this (XMLDB schema annotations are left out for simplicity):
<xs:schema xmlns:xs=" .... " />
<xs:element name=“A“>
<xs:complexType>
<xs:sequence>
<xs:element name=“B“ maxOccurs=“unbounded“/>
<xs:complexType>
<xs:sequence>
<xs:element name = “C“ maxOccurs=“unbounded“/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
After registering this schema in Oracle, I can define a table like this:
CREATE TABLE ATable
id NUMBER,
doc XMLTYPE
XMLTYPE COLUMN doc
XMLSCHEMA “ASchema“ ELEMENT “A“
VARARRAY doc.“XMLDATA“.“B“ STORE AS TABLE “BTable“
((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX)
This creates a nested table "BTable" within the table "ATable". So far so good, I can use this nested table to gain faster access on every possible subelement of Element B when I set an appropriate index.
I now want to create another nested table for element “C“ like this:
DROP TABLE ATable;
CREATE TABLE ATable
id NUMBER,
doc XMLTYPE
XMLTYPE COLUMN doc
XMLSCHEMA “ASchema“ ELEMENT “A“
VARARRAY doc.“XMLDATA“.“B“ STORE AS TABLE “BTable“
((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX)
VARARRAY doc.“XMLDATA“.“B“.“C“ STORE AS TABLE “CTable“
((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX)
But this statement fails with the error message something like „ ... no such attribute ... „
And here's my question: is it possible to create nested tables for repeatable XML Elements that are subelements of other repeatable XML Elements ? And if so, how can I do it ?
Thank you very much in advance
JanFound a (partial) solution myself:
If you add the attribute xdb:storeVarrayAsTable="true" to the root element of the XML schema, Oracle XMLDB generates nested tables for all repeatable XML Elements while registering the XML schema.
Unfortunately, the names of these nested tables are system-generated, hence it's a bit uncomfortable to set indices on them. You can find out the names of these nested tables as follows:
select table_name, parent_table_name, parent_table_column from user_nested_tables;
Further information on that subject is supplied in the following thread:
Re: default tables for elements with maxoccurs > 1
It would be nice if there was a way to name the generated nested tables via appropriate XMLDB schema annotations.
regards
Jan -
I am new to AQ and XML,
We have a situation at our project, the last DBA left us without any previous notice and no one here know AQ and XML. So now it is my duty to learn and work on this project.
We are getting Queue with XML information (i mean data) we have to dequeue and then store that data in oracle tables.
I tried to each and every site to get a grip of what's the basic here, but I get lost. It's more easy for me to understand a concept by going through examples rather study chapters.
This is what I did today from this site. (http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html#PLSQLCode)
created the potable, then loaded data in potable as per example. Now I want to load this data in a table which I created in Oracle (10.2....) table.
CREATE OR REPLACE PROCEDURE loadpurchaseorder
IS
-- Declare a CLOB variable
poxml CLOB;
BEGIN
-- Store the Purchase Order XML in the CLOB variable
poxml :=
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PurchaseOrder>
<PONum>1001</PONum>
<Company>Oracle Corp</Company>
<PONum>1002</PONum>
<Company>NPC Corp</Company>
<PONum>1003</PONum>
<Company>FDCA Corp</Company>
<PONum>1004</PONum>
<Company>Mahesh Corp</Company>
<PONum>1005</PONum>
<Company>Habeeb Corp</Company>
</PurchaseOrder>';
-- Insert the Purchase Order XML into an XMLType column
INSERT INTO potable
(purchaseorder
VALUES (XMLTYPE (poxml)
--Handle the exceptions
EXCEPTION
WHEN OTHERS
THEN
raise_application_error
(-20101
, 'Exception occurred in loadPurchaseOrder procedure :'
|| Sqlerrm
END loadpurchaseorder;
execute loadpurchaseorder;PL/SQL procedure successfully completed.
Elapsed: 00:00:00.04
select count(*) from potable;COUNT(*)
1
Elapsed: 00:00:00.00
select * from potable;PURCHASEORDER
<?xml version="1.0" encoding="ISO-8859-1" standalone='yes'?>
<PurchaseOrder>
<PONum>1001</PONum>
<Company>Oracle Corp</Company>
<PONum>1002</PONum>
<Company>NPC Corp</Company>
<PONum>1003</PONum>
<Company>FDCA Corp</Company>
<PONum>1004</PONum>
<Company>Mahesh Corp</Company>
<PONum>1005</PONum>
<Company>Habeeb Corp</Company>
</PurchaseOrder>
Elapsed: 00:00:00.03
create table xml_ora_data(corp_id number, corp_name varchar2(30));Table created.
Now I want data from potable to be loaded in xml_ora_data.
any help is appriciated...
Thanks
HabeebThanks for the quick response...
XML_ORA_DATA is the table I created as below..
create table xml_ora_data(corp_id number, corp_name varchar2(30));
Maybe you are looking for
-
Here's my problem...The latest version of Quicktime as new as it sounds doesn't support screen recording on a powermac G5 Motorola chip with OS 10.5.8 which is the highest os I can go with that machine. If I can sync the two computers so I can get th
-
I know that this issue has been brought up several times, and I have followed a few of the suggestions to no avail, I also have run Sophos which turned up nothing. Attached is the problem, report, any help would be appreciated. Process: com
-
Installing Cold Fusion MX Developer on XP Pro
My Cold Fusion developer version that came with Studio MX (original MX) is not installing correctly and/or my CF administrator pages doesn't open, giveng me the following stack error. Would it just be easier to download a fresh developer version from
-
Material Master Creation Using BAPI
Hi, I m using BAPI_MATERIAL_SAVEDATA for Material creation using BAPI. Now the problem is , i have created a Screen exit long back in Purchasing view.. the corresponding Z field is created in table MARC.. How can i pass value to this Z field using BA
-
Cannot upgrade from 9i databases to 10.2.0.3 on Solaris
You cannot upgrade from Oracle 9.2 database to 10.2.0.3 on Solaris. You can upgrade to 10.2.0.2, then to 10.2.0.3 There is a serious problem though doing a direct upgrade, the database will not function. You get ORA-06512: at "SYS.UPGRADE_SYSTEM_TYPE