Xml query foramt..
hi all,
i need help with the following query,
select xmlelement("l", xmlattributes(lxxxx_code as "id", xxxx_FLAG AS "b" , dbms_lob.substr(text,4000,1) as "d")) from wrk_xxxx_xx_l;
the out put of the query should look like
<l id="en_US" b="0" d="BUSH, STABILIZER"/>
i am able to xmlcollect and xml attribute and generate following output
<l id="en_US" b="0" d="BUSH, STABILIZER"></l>
is there a way we can generate the output that i wanted through xml..
Use XMLSerialize function with INDENT option, if your version supports it (requires 11.1) :
SQL> select xmlserialize(document
2 xmlelement("l",
3 xmlattributes(
4 '1' as "id"
5 , '0' as "flag"
6 )
7 )
8 as clob indent
9 )
10 from dual ;
XMLSERIALIZE(DOCUMENTXMLELEMEN
<l id="1" flag="0"/>
Similar Messages
-
Hi
I am working on BLS and having problem in xml query.I want to perform some calculation over xml columns.Than total of this as a new column.I can do this part in logic editor itself but can i do these both task by XSLT.
Can be made our own XSLT for this ?
I am feeling kind of fear to xslt. Can anybody help me in this.
Thanks a lot in advance
thomasRam,
In xMII there is a list of predefined xslt transforms that do something similar to what you are explaining. The 3 that I think may be what you are looking for are
they are under Calculation Transformations and Subtotal Transformation take a look at these and tell me if they are doing what you want to accomplish. In the xMII help file do a search on Inline Transforms or navigate to Advanced Topics -> Inline Transforms -> Predefined Inline Transforms. In this section there are examples of how to use these transforms and apply them in the query templates. If this is not what you are looking for can you explain in a little more detail along with a simple example of how you want this transform to work. Also why do you want to use xslt if you can already accomplish this in BLS?
Regards,
Erik -
Converting Oracle XML Query Result in Java String by using XSU
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
ThanksHmmm.. Pretty basic just look at the example:
OracleXMLQuery qry = new OracleXMLQuery(conn,"Select max(ps.datum) from preise ps where match='"+args[0]+"'");
String xmlString = qry.getXMLString();
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
Thanks -
How to tune the performance of Oracle SQL/XML query?
Hi all,
I am running Oracle 9i and like to run the following Oracle SQL/XML query. It takes about 3+ hour and still not finish. If I get rid all the XML stuffs it only take minutes to run. Does anybody know how to what's the reason of this slow and how to tune it?
SELECT XMLElement("CUSTOMER",
XMLForest(C_CUSTKEY "C_CUSTKEY", C_NAME "C_NAME", C_ADDRESS "C_ADDRESS", C_PHONE "C_PHONE", C_MKTSEGMENT "C_MKTSEGMENT", C_COMMENT "C_COMMENT"),
(SELECT XMLAgg(XMLElement("ORDERS",
XMLForest(O_ORDERKEY "O_ORDERKEY", O_CUSTKEY "O_CUSTKEY", O_ORDERSTATUS "O_ORDERSTATUS", O_ORDERPRIORITY "O_ORDERPRIORITY", O_CLERK "O_CLERK", O_COMMENT "O_COMMENT"),
(SELECT XMLAgg(XMLElement("LINEITEM",
XMLForest(L_ORDERKEY "L_ORDERKEY", L_RETURNFLAG "L_RETURNFLAG", L_LINESTATUS "L_LINESTATUS", L_SHIPINSTRUCT "L_SHIPINSTRUCT", L_SHIPMODE "L_SHIPMODE", L_COMMENT "L_COMMENT")
FROM LINEITEM
WHERE LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY)
FROM ORDERS
WHERE ORDERS.O_CUSTKEY = CUSTOMER.C_CUSTKEY)
FROM CUSTOMER ;
Thanks very much in advance for your time,
Jinghao Liuajallen wrote:
Why not something more like
SELECT *
FROM fact1 l,
FULL OUTER JOIN fact1 d
ON l.company = d.company
AND l.transactiontypeid = 1
AND d.transactiontypeid = 2;
Because this is not an equivalent of the original query.
drop table t1 cascade constraints purge;
drop table t2 cascade constraints purge;
create table t1 as select rownum t1_id from dual connect by level <= 5;
create table t2 as select rownum+2 t2_id from dual connect by level <= 5;
select * from (select * from t1 where t1_id > 2) t1 full outer join t2 on (t1_id = t2_id);
select * from t1 full outer join t2 on (t1_id = t2_id and t1_id > 2);
T1_ID T2_ID
3 3
4 4
5 5
6
7
T1_ID T2_ID
1
2
3 3
4 4
5 5
6
7 -
How to perf tune Oracle SQL/XML query?
Hi all,
I am using Oracle 9i and like to run the following Oracle SQL/XML query. It takes about 3+ hour and still not finish. If I get rid all the XML stuffs it only take minutes to run. Does anybody know how to what's the reason of this slow and how to tune it?
SELECT XMLElement("CUSTOMER",
XMLForest(C_CUSTKEY "C_CUSTKEY", C_NAME "C_NAME", C_ADDRESS "C_ADDRESS", C_PHONE "C_PHONE", C_MKTSEGMENT "C_MKTSEGMENT", C_COMMENT "C_COMMENT"),
(SELECT XMLAgg(XMLElement("ORDERS",
XMLForest(O_ORDERKEY "O_ORDERKEY", O_CUSTKEY "O_CUSTKEY", O_ORDERSTATUS "O_ORDERSTATUS", O_ORDERPRIORITY "O_ORDERPRIORITY", O_CLERK "O_CLERK", O_COMMENT "O_COMMENT"),
(SELECT XMLAgg(XMLElement("LINEITEM",
XMLForest(L_ORDERKEY "L_ORDERKEY", L_RETURNFLAG "L_RETURNFLAG", L_LINESTATUS "L_LINESTATUS", L_SHIPINSTRUCT "L_SHIPINSTRUCT", L_SHIPMODE "L_SHIPMODE", L_COMMENT "L_COMMENT")
FROM LINEITEM
WHERE LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY)
FROM ORDERS
WHERE ORDERS.O_CUSTKEY = CUSTOMER.C_CUSTKEY)
FROM CUSTOMER ;
Thanks very much in advance for your time,
Jinghao LiuPlease post this message at:
Forums Home » Oracle Technology Network (OTN) » Products » Database » XML DB -
I have troubles with my XML query. It returns to many results and double results.
My code
select xmlelement("test", XMLAgg(xmlelement("Customer", XmlAttributes(a.CUSTOMER_ID "cid"))),
XMLAgg(xmlelement("Account", xmlagg(xmlelement("Account", b.ACCOUNT_ID) ))),
XMLAgg(xmlelement("ServicePoint", xmlagg(xmlelement("sp", c.SPID) ))) ).extract('*').getstringval() xml
From DM_SERVICE_POINT c, DM_CUSTOMER a, DM_ACCOUNT b where a.CUSTOMER_ID = b.CUSTOMER_ID And a.CUSTOMER_ID=c.CUSTOMER_ID AND a.CUSTOMER_ID='15058'
group by a.CUSTOMER_ID
i have 1 customer id in the table dm_customer, 2 account_id 's that are linked to customer_id with a FK. DM_Servicepoint contains 6 rows that are linked to dm_customer with a FK.
My result is 1 result for customer, thats correct but account shows 12 results, where i expect 2 results
and Service point shows also 12 records where i expect 6 records.
There is no direct link between account and service point but both are linked to customer. Each customer can have 1 or 2 account And each customer can have 1 or many servicepoints.
Can you help me?
Message was edited by:
MarindaNow to see whether we can get this to work with XML....Turns out it's a lot easier than I thought it would be:
SQL> select dbms_xmlgen.getxml('select c.name
2 , cursor(select a.acctno, a.name
3 from my_accounts a
4 where a.cust_id = c.id ) as accounts
5 , cursor(select s.sp_ref
6 from my_service_points s
7 where s.cust_id = c.id ) as srv_points
8 from my_customers c
9 ') from dual
10 /
DBMS_XMLGEN.GETXML('SELECTC.NAME,CURSOR(SELECTA.ACCTNO,A.NAMEFROMMY_ACCOUNTSAWHE
<?xml version="1.0"?>
<ROWSET>
<ROW>
<NAME>APC</NAME>
<ACCOUNTS>
<ACCOUNTS_ROW>
<ACCTNO>900000</ACCTNO>
<NAME>No1 a/c</NAME>
</ACCOUNTS_ROW>
<ACCOUNTS_ROW>
<ACCTNO>900002</ACCTNO>
<NAME>Business</NAME>
</ACCOUNTS_ROW>
</ACCOUNTS>
<SRV_POINTS>
<SRV_POINTS_ROW>
<SP_REF>SP1</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP2</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP3</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP4</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP5</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP6</SP_REF>
</SRV_POINTS_ROW>
</SRV_POINTS>
</ROW>
<ROW>
<NAME>MARINDA</NAME>
<ACCOUNTS>
<ACCOUNTS_ROW>
<ACCTNO>900004</ACCTNO>
<NAME>Checking</NAME>
</ACCOUNTS_ROW>
</ACCOUNTS>
<SRV_POINTS>
<SRV_POINTS_ROW>
<SP_REF>SP7</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP8</SP_REF>
</SRV_POINTS_ROW>
</SRV_POINTS>
</ROW>
</ROWSET>
SQL> Obviously you'll need to do some smartening up of the tag names.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
Hi experts,
I am looking for help on the following XML query. I have a table (example) organized as such:
meas data_element
ABC rate
DEF rate1
DEF rate2
DEF rate3
GHI rate
JKL rate1a
JKL rate2b I'm trying to keep the "meas" column as the top node attribute, with the "data_elements" as attributes of the children of "meas"
In short, I'm looking for the following output, but, well..keep coming up short.
<meas id="ABC">
<data_elements>
<data_element id="rate">
<rpt>false</rpt>
</data_element>
</data_elements>
</meas>
<meas id="DEF">
<data_elements>
<data_element id="rate1">
<rpt>false</rpt>
</data_element>
<data_element id="rate2">
<rpt>false</rpt>
</data_element>
<data_element id="rate3">
<rpt>false</rpt>
</data_element>
<data_elements>
</meas>
.....and so forth...I'm having trouble with getting the multiple rows of 'data_element' under 'data_elements', and under the single 'meas' one node, any suggestions? My code keeps generating multiple rows. The rpt node is a constant value of 'false'
ThanksYou have to group, and aggregate using XMLAgg :
SQL> set long 5000
SQL>
SQL> with sample_data (meas, data_element) as (
2 select 'ABC', 'rate' from dual union all
3 select 'DEF', 'rate1' from dual union all
4 select 'DEF', 'rate2' from dual union all
5 select 'DEF', 'rate3' from dual union all
6 select 'GHI', 'rate' from dual union all
7 select 'JKL', 'rate1a' from dual union all
8 select 'JKL', 'rate2b' from dual
9 )
10 select xmlserialize(content
11 xmlagg(
12 xmlelement("meas",
13 xmlattributes(meas as "id")
14 , xmlelement("data_elements",
15 xmlagg(
16 xmlelement("data_element",
17 xmlattributes(data_element as "id")
18 , xmlelement("rpt", 'false')
19 )
20 order by data_element -- if necessary
21 )
22 )
23 )
24 )
25 indent
26 ) as result
27 from sample_data
28 group by meas ;
RESULT
<meas id="ABC">
<data_elements>
<data_element id="rate">
<rpt>false</rpt>
</data_element>
</data_elements>
</meas>
<meas id="DEF">
<data_elements>
<data_element id="rate1">
<rpt>false</rpt>
</data_element>
<data_element id="rate2">
<rpt>false</rpt>
</data_element>
<data_element id="rate3">
<rpt>false</rpt>
</data_element>
</data_elements>
</meas>
<meas id="GHI">
<data_elements>
<data_element id="rate">
<rpt>false</rpt>
</data_element>
</data_elements>
</meas>
<meas id="JKL">
<data_elements>
<data_element id="rate1a">
<rpt>false</rpt>
</data_element>
<data_element id="rate2b">
<rpt>false</rpt>
</data_element>
</data_elements>
</meas> -
Xcelsius with XMLA or XML Query Result Set
Hi Experts,
I want a direct connection from Xcelsius to my BW-Data. Because the new connection, coming with Fix Pack 2.1 is only avaiable for EHP 1 for NW 7.0 I tried to configure with XMLA and XML Query Result Set.
This Document tells the necessary steps: How to integrate Xcelsius 2008 with SAP NetWeaver BI without Integration Kit.pdf.
When I test my XML connection over http://<host>:<port>/TXmla/srvlet/TestXmla my Cubes will display.
So I do a Webservice-Connection with WSDL-URL. At Input-Values there are some entries like CUBE_NAME, CATALOG_NAME...
Output values arent avalible. How do I use these elements to show my Data in Xcelsius?
My Problem with the XML Query Result Set Connection is, that when I Log On to VC the following error appears:
You are not authorized to view the requested resource.
So I get the authorisationobjects: S_DEVELOP and S_RS_COMP as describe in 'How To... Resolve Visual Composer Issues'.
What values have I to enter by S_RS_COMP? And how can I enter my External Service in S_SERVICE. At the type WS the service isnt't avaiable.
Regards,
JanTo use XMLA web service you need a wrapper function build to convert the XMLA output to the Xcelsius format. There are some documents available in SDN on how to do this.
You can use Live Office or Query as a Web service option to connect from Xcelsius to BW.
S_RS_COMP is the query ID which you are trying to access, S_SERVICE you can either give * or try to set up authorization log and see the expected value. -
Error in testing XML query result set web service
Hi
I was trying to test a <b>XML query result set web service</b> in BW system with tcode wsadmin but getting error like
<b>Cannot download WSDL from http://ibmbtsb02.megacenter.de.ibm.com:8070/sap/bw/xml/soap/queyview?sap-client=001&wsdl=1.1&mode=sap_wsdl: F:\usr\sap\W70\DVEBMGS70\j2ee\cluster\server0\apps\sap.com\com.sap.engine.services.webservices.tool\servlet_jsp\wsnavigator\root\WEB-INF\temp\ws1139464945296\wsdls\wsdlroot.wsdl (The system cannot find the path specified)</b>
I had tried it first time few days ago and was able to test it successfully with the same configuration settings.
Could any one of you please provide any suggestion on this?
Thanks in advance
Sudiphi
check this links it may help u.
http://help.sap.com/saphelp_nw04/helpdata/en/c3/e3072e65f04445a010847aa970b68b/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/d8/3bfc3f8fc2c542e10000000a1550b0/frameset.htm
Regards,
Manoseelan -
No method found for XML query element
Hi,
I have an EJB module which contains some entity beans.
If I try to deploy it or verify it using the Sun One Verifier Tool I get the following exception...
Error: ** Error trying to process file: java.lang.RuntimeException: No method found for XML query element: Ambiguous or invalid <query-method>
java.lang.RuntimeException: No method found for XML query element: Ambiguous or invalid <query-method>
at com.sun.enterprise.deployment.xml.EjbNode.parseQueries(EjbNode.java:700)
at com.sun.enterprise.deployment.xml.EjbNode.completeLoadingDescriptor(EjbNode.java:671)
at com.sun.enterprise.deployment.xml.EjbBundleNode.completeLoadingDescriptor(EjbBundleNode.java:524)
at com.iplanet.ias.deployment.EjbBundleXmlReader.load(EjbBundleXmlReader.java:249)
at com.iplanet.ias.deployment.EjbBundleXmlReader.loadStdAloneModule(EjbBundleXmlReader.java:162)
at com.sun.enterprise.tools.verifier.Verifier.openEjbJar(Verifier.java:2421)
at com.sun.enterprise.tools.verifier.Verifier.loadEjbJar(Verifier.java:1318)
at com.sun.enterprise.tools.verifier.Verifier.loadJar(Verifier.java:866)
at com.sun.enterprise.tools.verifier.gui.MainPanel.run(MainPanel.java:187)
at java.lang.Thread.run(Thread.java:536)
Look in file "EntityBeans.jar_verified.xml" for detailed results on test assertions.
This problem can be resolved by un-installing the IDE, removing my user directory, and re-installing the IDE (I am using SunOne Studio 5 SE Update 1). The problem is that it returns with alarming regularity.
Anyone else experiencing this? Any help would be much appreciated.Sometimes, but not always, this exception appears in the ide.log before the error first occurs.
com.sun.forte4j.j2ee.packaging.PackagingIOException: package/EntityBeans.ejbjar
at com.sun.forte4j.j2ee.packaging.PackagingUtil.writeJarFile(PackagingUtil.java:403)
at com.sun.forte4j.j2ee.packaging.PackagingUtil.writeJarFile(PackagingUtil.java:67)
at com.sun.forte4j.j2ee.ejbmodule.EJBModuleDataObject.writeEJBJar(EJBModuleDataObject.java:2673)
at com.iplanet.ias.tools.forte.verifier.VerifierAction.performAction(VerifierAction.java:63)
at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:431)
at org.netbeans.core.ModuleActions$1.run(ModuleActions.java:97)
at org.openide.util.Task.run(Task.java:136)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:328)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:670) -
hi gurus...
what i m trying to 2 is to import a xml (query exported from production system) into test system, but this message is shown :
bold
Manually start the maintenance transaction for objects of type CWM Document
bold
has someone what the transaction is? and what does it mean?
regards
jokerHi Joker,
Did you resolve the issue. "Manually start the maintenance transaction for objects of type CWM Document"
If you have resolved this issue can you please let me know.
Regards,
Anil -
Use of Global Properties in URL path of XML Query
I am trying to use global properties to define the URL of XML query:
Globals.ImageFilePath&"SomePath/\File.xml"
but it does not like it. If I put the content of the Globals.ImageFilePath it works fine. What is the synatax for that?
I am using the XML query in a transaction within an image creation action block. When I try to define the URL parameter of the XML file as a link, it is not taken on account, and the image created has no data (it is empty). The URL is taken when defined on the Cofigure Object screen, but there I have the same problem to use the global variable parameter.
Any suggestions?
Thanks,
Vlad
Edited by: Vladimir Baltchev on Jul 29, 2008 11:33 PM
Edited by: Vladimir Baltchev on Jul 29, 2008 11:40 PMAs I mentioned in my first posting, yes, I can put the global variable of the link editor for the URL parameter, it evaluates well, but it is not taken on account by the query, and the image generated is empty. Obviously there is a bug here, so I am trying to find a work around to use the global variable on the Configure Object screen, where the parameter URL is taken by the XML query, but on this screen I can not use the global variable. It works only if I put the content of the global variable.
So, does anybody know if we can use global variables on a Configure Object screen, or on the XML query URL field, and if so, what is the syntax to indicate global variable?
Thanks again,
Vlad -
Cooresponding Lists Names/Values XML Query
Let's say there is an XML Schema that has
<element name="mt" minOccurs="0" maxOccurs="unbounded">
<element name="r" minOccurs="0" maxOccurs="unbounded">
And for each measurement type (mt), you have a cooresponding measurement value (r). There are additional elements between these two lists. The actual XML data would look similiar to
<mi>
<mts>20061117100000-0800</mts>
<gp>900</gp>
<mt>MeasurementType1</mt>
<mt>MeasurementType2</mt>
<mt>MeasurementType3</mt>
<mt>MeasurementType4</mt>
<mt>MeasurementType5</mt>
<mt>MeasurementType6</mt>
<mt>MeasurementType7</mt>
<mv>
<moid>Identifier</moid>
<r>58</r>
<r>62</r>
<r>43</r>
<r>45</r>
<r>43</r>
<r>14</r>
<r>29</r>
<sf>FALSE</sf>
</mv>
</mi>
The first occurance of mt corresponds to the first occurance of r, the second cooresponds to the second, et cetra.
The MI element can repeat hundreds of times and there can be many measurementTypes. Now, I'm trying to figure out how I can create an XML query to efficiently handle this. The problem is that the <r> value is within the complexType <mv> and that is on the same level as <mt>. The XML Query would cause a cartesian product if I were to use something like ...
select
extractValue(value(xmldata), '/mi/mts') measurement_time_stamp,
extractValue(value(xmldata), '/mi/gp') granularity_period,
extractValue(value(mt), '/mt') measurement_type,
extractValue(value(mv), '/mv/moid') measured_obj_id,
extractValue(value(r), '/r') measurement_value,
from xmltable
, TABLE(XMLSequence(Extract(value(xmltable), '/mi/mv'))) mv
, TABLE(XMLSequence(Extract(value(mi), '/mi/mt'))) mt
, TABLE(XMLSequence(Extract(value(mi), '/mv/r'))) r
This obviously wouldn't work. I could go and store all the types and values into a column using
select
replace(replace(replace(extract(value(mi), '/mi/mt').getStringVal(), '</mt><mt>', ';'), '<mt>'), '</mt>') measurement_type,
extractValue(value(mv), '/mv/moid') measured_obj_id,
replace(replace(replace(extract(value(mv), '/mv/r').getStringVal(), '</r><r>', ';'), '<r>'), '</r>') measurement_value
from xmltable
TABLE(XMLSequence(Extract(value(xmldata), '/md/mi'))) mi
, TABLE(XMLSequence(Extract(value(mi), '/mi/mv'))) mv
But this wouldn't work once the XML grew over 4000 bytes. So I need a way to extract this data maintaining the correct integrity (avoiding cartesians).
One idea is a pipelined table function but I have concerns about scalability with that method. Is there a way to accomplish this optimally? I have solutions for this but none of them is going to deliver the scalability I am seeking.
I expect the method chosen will probably need to handle a few hundred thousand files per day.
Thanks,VJ
I'd not seen your XML schema when I worked the original example, so I reverse engineered it from the instance. Unfortunately when I work with your schema, which contains more levels of nested I can't get it to optimize properly
Here's what should work in theory
SQL> set echo on
SQL> spool testcase.log
SQL> --
SQL> connect sys/ as sysdba
Enter password:
Connected.
SQL> set define on
SQL> --
SQL> define USERNAME = OTNTEST
SQL> --
SQL> def PASSWORD = OTNTEST
SQL> --
SQL> def USER_TABLESPACE = USERS
SQL> --
SQL> def TEMP_TABLESPACE = TEMP
SQL> --
SQL> def LOCAL_FILESYSTEM = 'C:\xdb\otn\457595'
SQL> --
SQL> drop user &USERNAME cascade
2 /
old 1: drop user &USERNAME cascade
new 1: drop user OTNTEST cascade
User dropped.
SQL> grant connect, resource to &USERNAME identified by &PASSWORD
2 /
old 1: grant connect, resource to &USERNAME identified by &PASSWORD
new 1: grant connect, resource to OTNTEST identified by OTNTEST
Grant succeeded.
SQL> grant create any directory, drop any directory to &USERNAME
2 /
old 1: grant create any directory, drop any directory to &USERNAME
new 1: grant create any directory, drop any directory to OTNTEST
Grant succeeded.
SQL> grant alter session, create view to &USERNAME
2 /
old 1: grant alter session, create view to &USERNAME
new 1: grant alter session, create view to OTNTEST
Grant succeeded.
SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
2 /
old 1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
new 1: alter user OTNTEST default tablespace USERS temporary tablespace TEMP
User altered.
SQL> connect &USERNAME/&PASSWORD
Connected.
SQL> --
SQL> alter session set events ='19027 trace name context forever, level 0x800'
2 /
Session altered.
SQL> var schemaURL varchar2(256)
SQL> var schemaPath varchar2(256)
SQL> --
SQL> create or replace directory XMLDIR as '&LOCAL_FILESYSTEM'
2 /
old 1: create or replace directory XMLDIR as '&LOCAL_FILESYSTEM'
new 1: create or replace directory XMLDIR as 'C:\xdb\otn\457595'
Directory created.
SQL> begin
2 :schemaURL := 'testcase.xsd';
3 :schemaPath := '/public/testcase.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL>
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
5 <!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com)-->
6 <!--Please add namespace attributes, a targetNamespace attribute and import elements according to your requirements-->
7 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" attributeFormDefaul
t="unqualified" xdb:storeVarrayAsTable="true">
8 <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
9 <xs:element name="mdc" xdb:defaultTable="MDC_TABLE">
10 <xs:complexType xdb:SQLType="MDC_TYPE" xdb:maintainDOM="false">
11 <xs:sequence>
12 <xs:element ref="mfh"/>
13 <xs:element ref="md" minOccurs="0" maxOccurs="unbounded"/>
14 <xs:element ref="mff"/>
15 </xs:sequence>
16 </xs:complexType>
17 </xs:element>
18 <xs:element name="mfh" xdb:defaultTable="">
19 <xs:complexType xdb:SQLType="MFH_TYPE" xdb:maintainDOM="false">
20 <xs:sequence>
21 <xs:element ref="ffv"/>
22 <xs:element ref="sn"/>
23 <xs:element ref="st"/>
24 <xs:element ref="vn"/>
25 <xs:element ref="cbt"/>
26 </xs:sequence>
27 </xs:complexType>
28 </xs:element>
29 <xs:element name="md" xdb:defaultTable="" >
30 <xs:complexType xdb:SQLType="MD_TYPE" xdb:maintainDOM="false">
31 <xs:sequence>
32 <xs:element ref="neid"/>
33 <xs:element ref="mi" minOccurs="0" maxOccurs="unbounded" />
34 </xs:sequence>
35 </xs:complexType>
36 </xs:element>
37 <xs:element name="neid" xdb:defaultTable="" >
38 <xs:complexType xdb:SQLType="NEID_TYPE" xdb:maintainDOM="false">
39 <xs:sequence>
40 <xs:element ref="neun"/>
41 <xs:element ref="nedn"/>
42 </xs:sequence>
43 </xs:complexType>
44 </xs:element>
45 <xs:element name="mi" xdb:defaultTable="" >
46 <xs:complexType xdb:SQLType="MI_TYPE" xdb:maintainDOM="false">
47 <xs:sequence>
48 <xs:element ref="mts"/>
49 <xs:element ref="gp"/>
50 <xs:element ref="mt" minOccurs="0" maxOccurs="unbounded"/>
51 <xs:element ref="mv" minOccurs="0" maxOccurs="unbounded" />
52 </xs:sequence>
53 </xs:complexType>
54 </xs:element>
55 <xs:element name="mv" xdb:defaultTable="" >
56 <xs:complexType xdb:SQLType="MV_TYPE" xdb:maintainDOM="false">
57 <xs:sequence>
58 <xs:element ref="moid"/>
59 <xs:element ref="r" minOccurs="0" maxOccurs="unbounded"/>
60 <xs:element ref="sf" minOccurs="0"/>
61 </xs:sequence>
62 </xs:complexType>
63 </xs:element>
64 <xs:element name="mff" xdb:defaultTable="" >
65 <xs:complexType xdb:maintainDOM="false">
66 <xs:sequence>
67 <xs:element ref="ts"/>
68 </xs:sequence>
69 </xs:complexType>
70 </xs:element>
71 <xs:element name="ts" type="xs:string"/>
72 <xs:element name="sf" type="xs:string"/>
73 <xs:element name="r">
74 <xs:complexType xdb:SQLType="R_TYTPE" xdb:maintainDOM="false">
75 <xs:simpleContent>
76 <xs:extension base="xs:string">
77 <xs:attribute ref="dummy" use="prohibited"/>
78 </xs:extension>
79 </xs:simpleContent>
80 </xs:complexType>
81 </xs:element>
82 <xs:attribute name="dummy" type="xs:boolean"/>
83 <xs:element name="mt">
84 <xs:complexType xdb:SQLType="MT_TYTPE" xdb:maintainDOM="false">
85 <xs:simpleContent>
86 <xs:extension base="xs:string">
87 <xs:attribute ref="dummy" use="prohibited"/>
88 </xs:extension>
89 </xs:simpleContent>
90 </xs:complexType>
91 </xs:element>
92 <xs:element name="moid" type="xs:string"/>
93 <xs:element name="gp" type="xs:string"/>
94 <xs:element name="mts" type="xs:string"/>
95 <xs:element name="nedn" type="xs:string"/>
96 <xs:element name="neun" type="xs:string"/>
97 <xs:element name="cbt" type="xs:string"/>
98 <xs:element name="vn" type="xs:string"/>
99 <xs:element name="st" type="xs:string"/>
100 <xs:element name="sn" type="xs:string"/>
101 <xs:element name="ffv" type="xs:string"/>
102 </xs:schema>');
103 begin
104 if (dbms_xdb.existsResource(:schemaPath)) then
105 dbms_xdb.deleteResource(:schemaPath);
106 end if;
107 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
108 end;
109 /
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 :schemaURL,
5 xdbURIType(:schemaPath).getClob(),
6 TRUE,TRUE,FALSE,TRUE
7 );
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> declare
2 nested_table_name varchar2(256);
3 iot_index_name varchar2(256);
4 begin
5 select table_name
6 into nested_table_name
7 from user_nested_tables
8 where parent_table_column = '"XMLDATA"."md"'
9 and parent_table_name = 'MDC_TABLE';
10
11 execute immediate 'rename "'|| nested_table_name ||'" to MD_TABLE';
12
13 select index_name
14 into iot_index_name
15 from user_indexes
16 where table_name = 'MD_TABLE' and index_type = 'IOT - TOP';
17
18 execute immediate 'alter index "'|| iot_index_name ||'" rename to MD_IOT';
19
20 select table_name
21 into nested_table_name
22 from user_nested_tables
23 where parent_table_column = 'mi'
24 and parent_table_name = 'MD_TABLE';
25
26 execute immediate 'rename "'|| nested_table_name ||'" to MI_TABLE';
27
28 select index_name
29 into iot_index_name
30 from user_indexes
31 where table_name = 'MI_TABLE' and index_type = 'IOT - TOP';
32
33 execute immediate 'alter index "'|| iot_index_name ||'" rename to MI_IOT';
34
35 select table_name
36 into nested_table_name
37 from user_nested_tables
38 where parent_table_column = 'mt'
39 and parent_table_name = 'MI_TABLE';
40
41 execute immediate 'rename "'|| nested_table_name ||'" to MT_TABLE';
42
43 select index_name
44 into iot_index_name
45 from user_indexes
46 where table_name = 'MT_TABLE' and index_type = 'IOT - TOP';
47
48 execute immediate 'alter index "'|| iot_index_name ||'" rename to MT_IOT';
49
50 select table_name
51 into nested_table_name
52 from user_nested_tables
53 where parent_table_column = 'mv'
54 and parent_table_name = 'MI_TABLE';
55
56 execute immediate 'rename "'|| nested_table_name ||'" to MV_TABLE';
57
58 select index_name
59 into iot_index_name
60 from user_indexes
61 where table_name = 'MV_TABLE' and index_type = 'IOT - TOP';
62
63 execute immediate 'alter index "'|| iot_index_name ||'" rename to MV_IOT';
64
65 select table_name
66 into nested_table_name
67 from user_nested_tables
68 where parent_table_column = 'r'
69 and parent_table_name = 'MV_TABLE';
70
71 execute immediate 'rename "'|| nested_table_name ||'" to R_TABLE';
72
73 select index_name
74 into iot_index_name
75 from user_indexes
76 where table_name = 'R_TABLE' and index_type = 'IOT - TOP';
77
78 execute immediate 'alter index "'|| iot_index_name ||'" rename to R_IOT';
79 end;
80 /
PL/SQL procedure successfully completed.
SQL> desc MDC_TABLE
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "testcase.xsd" Element "mdc") STORAGE Object-relational TYPE "MDC_TYPE"
SQL> --
SQL> desc MD_TABLE
Name Null? Type
neid NEID_TYPE
mi mi9495_COLL
SQL> --
SQL> desc MI_TABLE
Name Null? Type
mts VARCHAR2(4000 CHAR)
gp VARCHAR2(4000 CHAR)
mt mt9493_COLL
mv mv9494_COLL
SQL> --
SQL> desc MT_TABLE
Name Null? Type
SYS_XDBBODY$ VARCHAR2(4000 CHAR)
dummy RAW(1)
SQL> --
SQL> desc MV_TABLE
Name Null? Type
moid VARCHAR2(4000 CHAR)
r r9492_COLL
sf VARCHAR2(4000 CHAR)
SQL> --
SQL> desc R_TABLE
Name Null? Type
SYS_XDBBODY$ VARCHAR2(4000 CHAR)
dummy RAW(1)
SQL> --
SQL> set autotrace on explain
SQL> set lines 150 pages 100
SQL> --
SQL> var XMLTEXT varchar2(4000)
SQL> --
SQL> begin
2 :xmlText :=
3 '<mdc>
4 <mfh>
5 <ffv/>
6 <sn/>
7 <st/>
8 <vn/>
9 <cbt/>
10 </mfh>
11 <md>
12 <neid>
13 <neun/>
14 <nedn/>
15 </neid>
16 <mi>
17 <mts>20061117100000-0800</mts>
18 <gp>900</gp>
19 <mt>MeasurementType1</mt>
20 <mt>MeasurementType2</mt>
21 <mt>MeasurementType3</mt>
22 <mt>MeasurementType4</mt>
23 <mt>MeasurementType5</mt>
24 <mt>MeasurementType6</mt>
25 <mt>MeasurementType7</mt>
26 <mv>
27 <moid>Identifier</moid>
28 <r>58</r>
29 <r>62</r>
30 <r>43</r>
31 <r>45</r>
32 <r>43</r>
33 <r>14</r>
34 <r>29</r>
35 <sf>FALSE</sf>
36 </mv>
37 </mi>
38 </md>
39 <mff>
40 <ts/>
41 </mff>
42 </mdc>';
43 end;
44 /
PL/SQL procedure successfully completed.
SQL> insert into MDC_TABLE values ( xmltype ( :xmltext ))
2 /
1 row created.
Execution Plan
Plan hash value: 1621636734
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | INSERT STATEMENT | | 1 | 100 | 1 (0)| 00:00:01 |
| 1 | LOAD TABLE CONVENTIONAL | MDC_TABLE | | | | |
SQL> commit
2 /
Commit complete.
SQL> select MT_INDEX, MT_VALUE, R_VALUE
2 from MDC_TABLE,
3 xmlTable
4 (
5 '/mdc/md/mi'
6 passing object_value
7 columns
8 XML xmltype path '.'
9 ) MI,
10 xmlTable
11 (
12 '/mi/mt'
13 passing MI.XML
14 columns
15 MT_INDEX for ordinality,
16 MT_VALUE varchar2(32) path 'text()'
17 ) MT,
18 xmlTable
19 (
20 '/mi/mv/r'
21 passing MI.XML
22 columns
23 R_INDEX for ordinality,
24 R_VALUE varchar2(32) path 'text()'
25 ) R
26 where MT_INDEX = R_INDEX
27 /
MT_INDEX MT_VALUE R_VALUE
1 MeasurementType1 58
2 MeasurementType2 62
3 MeasurementType3 43
4 MeasurementType4 45
5 MeasurementType5 43
6 MeasurementType6 14
7 MeasurementType7 29
7 rows selected.
Execution Plan
Plan hash value: 2832518671
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5449M| 19T| 1616M (1)|999:59:59 |
| 1 | NESTED LOOPS | | 5449M| 19T| 1616M (1)|999:59:59 |
| 2 | NESTED LOOPS | | 66M| 237G| 197K (1)| 00:39:36 |
| 3 | NESTED LOOPS | | 8168 | 29M| 27 (0)| 00:00:01 |
|* 4 | TABLE ACCESS FULL | MDC_TABLE | 1 | 3788 | 3 (0)| 00:00:01 |
| 5 | COLLECTION ITERATOR PICKLER FETCH | XMLSEQUENCEFROMXMLTYPE | | | | |
| 6 | VIEW | | 8168 | 247K| 24 (0)| 00:00:01 |
| 7 | COUNT | | | | | |
| 8 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | | | | |
|* 9 | VIEW | | 82 | 2542 | 24 (0)| 00:00:01 |
| 10 | COUNT | | | | | |
| 11 | COLLECTION ITERATOR PICKLER FETCH | XMLSEQUENCEFROMXMLTYPE | | | | |
Predicate Information (identified by operation id):
4 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype('<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd http://xmlns.oracle.com/xdb/acl.xsd
DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-properties/><read-contents/></privilege>'))=1)
9 - filter("MT_INDEX"="R_INDEX")
Note
- dynamic sampling used for this statement
SQL>As you can see the re-write is not working out in this case. I'll ask development to take a look at it and see if they can solve it. I think it's similar to another bug I've filed...
WRT to your question about transforming. One easy transformation would be to number the nodes.. Eg use XSTL to add an index number to each MT node and each R node and then join on that value. -
Hi
Can someone please tell me how to work on <b>XML Query</b>. Mainly regarding what details to give for <b>Source URL</b> and <b>Transform URL</b>.
Thanks in Advance
Muzammil P.THi Muzammil,
XML query is used to get the xml documents in the server. One more thing is you can execute all queries and transactions built on xMII. For queries you need to use URL like http://<server name>/Lighthammer/Illuminator?QueryTemplate=<QT path>&Param.1=<value1>&Param.2=<Value 2>..
Similar way you can execute the transactions as http://<server name>/Lighthammer/Runner?Transaction=<Transaction name with path>&InpueParameter=<value 1>&OutputParameter=<TrOutput>..
The main advantage is you can execute any type of query and transaction. Dynamically you can change this values from the front end also..
These all the things i know in XML, may be there are some other features are also avialable..
Thanks,
Rajesh.
PS : Please award points if the answer is useful. -
Setting parameter in XML query
hi all,
how to use [Param.1] in XML query template?
-muraliya u can dynamically pass the values to business logic transaction
these are the steps
1.add a xml query action block and in the links map the input to the param.1 and param.2 etc...
2.now from the out going link of the query action block map it to the incoming of the generic sort filter
3.in that give the conditions for filtring
regards shyam
Maybe you are looking for
-
Error on Oracle 11gR2 RAC database Post upgrade step
[Upgrade the Oracle Clusterware Configuration|http://docs.oracle.com/cd/E11882_01/server.112/e23633/afterup.htm] Problem Description: O.S Version: HP-UX B.11.31 U ia64 It is upgrading of Oracle RAC 2 node database from 11.1.0.7.0 to 11.2.0.3.0 I rece
-
Output was not according to requirment?
Hi to All, I am facing a confused situation and i am unable to recognized the error where is that. Can any body help where i m going wrong in following Code? ============================================== public class test3f { public static int [] sm
-
Display of Sender Identity - Inconsistency
I use Apple's Mail as my email reader. When I receive an email that has been sent to a number of recipients some of the names are displayed with just the name and some with the name and email address, for example, "John Smith" or "John Smith <[email
-
Hello, I want to have the image on a page change each time someone refreshes the page. Have about 10 images, so a different one will be in place each time the user goes to the site. Does anyone have code for this , or point me in the right direction?
-
HT1386 Will itunes sync save video downloaded through app?
I have the Khan Archiver app on my ipod touch with many Khan Academy videos that I downloaded thrrough the app. Will syncing my itouch mean save those videos to my computer?