How to 'DESCRIBE' a XMLType table
Hi,
When I describe a XMLType table, the output is truncated as follow :
SQL> desc scott.purchaseorder
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "http://localhost:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Ele
Is there any way to show the complete string ?
I have tried 'SET LONG' and 'SET LINESIZE', but not succeeded.
Any suggestion ?
I've also found under windows that using sqlplus within a command window gives better results with wrapping text than using sqlplusw (the gui version). Also Oracle are deprecating sqlplusw in favour of the SQL worksheet in enterprise manager from version 10 onwards, although it does still get installed at the moment if you really want to keep using it.
Regards
Similar Messages
-
I am using a xmltype table for parsing the xml file and then storing the tag values into someother tables.
The table syntax
CREATE GLOBAL TEMPORARY TABLE ATLAS.XML_PROCESS
XML_DATA XMLTYPE
ON COMMIT DELETE ROWS;
At a time i will parse only one xml file. And them the content will be deleted and then i will parse another xml file.
The parsing of the xml file is taking much CPU time and also it is taking more FETCH time. ( i have seen from the trace file)
Do i need to create any index on this table?
Please suggest me how can i imrove the performence.
ThanksHi
Why do you use a GTT? Just keep your xml in memory...
HTH
Chris -
How to check a XMLTYPE table for corrupted (not invalid!) XML records ??
Hello,
I'd like to get help on the following issue, please. I need to check the XML data in a number of tables with XMLTYPE data type. Some of the data is corrupted but in terms not that the XML format is wrong but there is no XML at all in the fields but just only, for example, control characters (no tags, no anything, just corrupted data).
So, I have made a PL/SQL procedure cursor to get all the tables from a list, and then another cursor inside to browse each table for corrupted records. But can you help me how to check this? Any of the XML functions like for example: XMLIsValid, isFragment(), getrootelement(), etc. return to me an Oracle error "ORA-31011 XML parsing failed" and the procedure gets stuck on the first found bad record. But I need to continue and check all of them. Is it possible to get the ORA-31011 error with EXCEPTION, write to a logging table the corrupted record ID, and then continue?
Here is my simple procedure:
CREATE OR REPLACE PROCEDURE CHECKXML (v_schema in VARCHAR2)
IS
v_Message VARCHAR2(254);
sql_stmt1 VARCHAR2(1000);
sql_stmt2 VARCHAR2(1000);
c1 SYS_REFCURSOR;
c2 SYS_REFCURSOR;
cur_tab varchar2(100);
cur_appl varchar2(100);
cur_rec varchar2(200);
valid_flag number;
criteria VARCHAR2(20);
tab1 VARCHAR2(20);
tab2 VARCHAR2(20);
BEGIN
criteria := 'XMLTYPE';
sql_stmt1 := 'select id, path from ' || v_schema || '.stubfiles where type=:bcriteria';
open c1 for sql_stmt1 using criteria;
loop
begin
fetch c1 into cur_tab, cur_appl;
exit when c1%notfound;
insert into system.log_table values (sysdate, v_schema, 'next table', 'id ' || cur_tab, 'appl ' || cur_appl, '');
sql_stmt2 := 'select t.recid, t.xmlrecord.isFragment() from ' || v_schema || '.' || cur_tab || ' t';
open c2 for sql_stmt2;
loop
begin
fetch c2 into cur_rec, valid_flag;
exit when c2%notfound;
insert into system.log_table values (sysdate, v_Schema, 'next record', 'id ' || cur_tab, 'recid ' || cur_rec, 'valid ' || valid_flag);
commit;
EXCEPTION
WHEN OTHERS THEN v_Message := sqlerrm;
dbms_output.put_line('Error for ' || cur_tab);
dbms_output.put_line('-' || v_Message);
insert into system.log_table values (sysdate, cur_tab, 'id err' || c_Row.ID,'appl err' || c_Row.path, v_Message,'');
end;
end loop;
close c2;
commit;
end;
end loop;
close c1;
commit;
END CHECKXML;
Thanks in advance
EvgeniHi
Why do you use a GTT? Just keep your xml in memory...
HTH
Chris -
How to link a XMLType table to a repository?
I follow following steps:
1) register a schema and generate a default table
2) insert XML documents ( specifing the schema just registered) into the table by using SQL
But how to let those XML documents show up in the repository so that users can access to them by using HTTP/FTP so that any update done to the table will be reflected in the repository and vice versa.
I tried many things but no luck.Everything looks OK to me. In the folllowing example the createResource() is the equivilant of the WebDAV copy. Do you have multiple database instances running on the server machine. It is possible that the WebDAV connection is connected to another database instance.
What folder are you copying the data into
Can you do
select path from path_view where under_path(res,'/targetFolderForWebDav') = 1
SQL>
SQL> var schemaURL varchar2(256)
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
2 :schemaURL := 'http://localhost:8090/CMDEMO/fullname.xsd';
3 :schemaPath := '/public/testcase.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
2 /
Call completed.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<?xml version="1.0"?>
5 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
6 <xs:element name="fullName" type="xs:string" xdb:defaultTable="FULL_NAME_TABLE"/>
7 </xs:schema>
8 ');
9 begin
10 if (dbms_xdb.existsResource(:schemaPath)) then
11 dbms_xdb.deleteResource(:schemaPath);
12 end if;
13 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
14 end;
15 /
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> desc FULL_NAME_TABLE
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "http://localhost:8090/CMDEMO/fullname.xsd" Element "fullName")
SQL> --
SQL> set long 100000 lines 150
SQL> --
SQL> select *
2 from FULL_NAME_TABLE
3 /
no rows selected
Execution Plan
Plan hash value: 3651065813
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2022 | 2 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| FULL_NAME_TABLE | 1 | 2022 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - 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)
Note
- dynamic sampling used for this statement
SQL> declare
2 res boolean;
3 docPath varchar2(40) := '/public/testcase.xml';
4 xmldata xmlType := xmlType(
5 '<fullName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6 xsi:noNamespaceSchemaLocation="http://localhost:8090/CMDEMO/fullname.xsd">
7 David King
8 </fullName>');
9 begin
10 if (dbms_xdb.existsResource(docPath)) then
11 dbms_xdb.deleteResource(docpath);
12 end if;
13 res := dbms_xdb.createResource(docPath,xmldata);
14 end;
15 /
PL/SQL procedure successfully completed.
SQL> select *
2 from FULL_NAME_TABLE
3 /
SYS_NC_ROWINFO$
<fullName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://localhost:8090/CMDEMO/fullname.xsd">
David King
</fullName>
Execution Plan
Plan hash value: 3651065813
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2022 | 3 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| FULL_NAME_TABLE | 1 | 2022 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - 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)
Note
- dynamic sampling used for this statement
SQL>
SQL>
SQL>
SQL> -
Join two xmltype table using Xquery
I am wondering how to join two xmltype tables in xml db database. both tables are schema based object-relational tables.
these are the examples:
academicProgram table contain batch of academicprogram.xml entries
<academicProgram>
<listOfCourse>
<course><id>1</id></course>
<course><id>2</id></course>
</listOfCourse>
</academicProgram>
course table contain all the course entries, each of them is an xml file based on the the course schema. for example,
course1.xml
<course>
<id>1</id>
<title>xxxxxxx</title>
<description>xxxxxxxxxxxxxx</description>
</course>
I used the following xquery code to merge the detailed course information from course table to the academic program information
select *
from XMLTable(
for $program in ora:view("HTU", "ACADEMICPROGRAM")
return <academicProgram xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"
for $node in $program/academicProgram/node()
return if (name($node) eq "listOfCourse")
then (
<listOfCourse>{
for $i in $node/course
for $j in ora:view("HTU", "COURSE")/course
where $i/id eq $j/id
return $j
}</listOfCourse>
else $node
</academicProgram>
it did return what I want, but the problem is it take more than 5 minutes to finish. is there someway to make it run faster? I have been struggling for a week, please help.
thanks in advance.
HailiDoes this work...
SQL> var schemaURL varchar2(256)
SQL> var schemaPath varchar2(256)
SQL> --
SQL> set autotrace on explain
SQL> set lines 150 pages 0 long 10000
SQL> --
SQL> begin
2 :schemaURL := 'http://aahmb10-147:7575/public/www.mdanderson.org/schema/APEP/custom.xsd';
3 :schemaPath := '/public/custom.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
2 /
Call completed.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<xs:schema xmlns:apcustom="http://www.mdanderson.org/schema/APEP/custom" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="
http://www.mdanderson.org/schema/APEP/custom" elementFormDefault="qualified" attributeFormDefault="unqualified">
5 <xs:element name="CourseCatalogCustomDataType">
6 <xs:annotation>
7 <xs:documentation>Comment describing your root element</xs:documentation>
8 </xs:annotation>
9 </xs:element>
10 </xs:schema>');
11 begin
12 if (dbms_xdb.existsResource(:schemaPath)) then
13 dbms_xdb.deleteResource(:schemaPath);
14 end if;
15 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
16 end;
17 /
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> begin
2 :schemaURL := 'http://aahmb10-147:7575/public/www.mdanderson.org/schema/APEP/courseCatalog.xsd';
3 :schemaPath := '/public/courseCatalog.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
2 /
Call completed.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<?xml version="1.0" encoding="UTF-8"?>
5 <!-- edited with XMLSpy v2006 rel. 3 U (http://www.altova.com) by John Grossman (UT MD Anderson Cancer Center)
6 -->
7 <xs:schema xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog" xmlns:xs="http://www.w3.
org/2001/XMLSchema" xmlns:ns1="http://www.mdanderson.org/schema/APEP/custom" targetNamespace="http://www.mdanderson.org/schema/APEP/courseCa
talog" elementFormDefault="qualified" attributeFormDefault="unqualified" xdb:storeVarrayAsTable="true">
8 <xs:import namespace="http://www.mdanderson.org/schema/APEP/custom" schemaLocation="http://aahmb10-147:7575/public/www.mdanderson.or
g/schema/APEP/custom.xsd"/>
9 <!-- ######################################## -->
10 <!-- GLOBAL ELEMENTS -->
11 <!-- ######################################## -->
12 <xs:element name="course" type="CourseType" xdb:defaultTable="COURSE">
13 <xs:annotation>
14 <xs:documentation>Comment describing your root element</xs:documentation>
15 </xs:annotation>
16 </xs:element>
17 <xs:element name="listOfCourse" type="ListOfCourseType" xdb:defaultTable="COURSELIST"/>
18 <xs:element name="courseCatalog" type="CourseCatalogType" xdb:defaultTable="COURSECATALOG"/>
19 <!-- ######################################## -->
20 <!-- GLOBAL TYPES -->
21 <!-- ######################################## -->
22 <xs:complexType name="CompositeIDType" xdb:SQLType="COURSE_COMPOSITEID_T">
23 <xs:sequence>
24 <xs:element name="prefix" xdb:SQLName="PREFIX">
25 <xs:simpleType>
26 <xs:restriction base="xs:string">
27 <xs:length value="2"/>
28 </xs:restriction>
29 </xs:simpleType>
30 </xs:element>
31 <xs:element name="level" type="xs:positiveInteger" xdb:SQLName="COURSELEVEL"/>
32 <xs:element name="creditHours" type="xs:positiveInteger" xdb:SQLName="CREDITHOURS"/>
33 <xs:element name="identNumber" xdb:SQLName="IDENTNUMBER">
34 <xs:simpleType>
35 <xs:restriction base="xs:string">
36 <xs:length value="2"/>
37 </xs:restriction>
38 </xs:simpleType>
39 </xs:element>
40 </xs:sequence>
41 </xs:complexType>
42 <xs:complexType name="CourseType" xdb:SQLType="COURSE_T">
43 <xs:sequence>
44 <xs:element name="id" type="xs:integer" minOccurs="0" xdb:SQLName="ID"/>
45 <xs:element name="compositeID" type="CompositeIDType" minOccurs="0" xdb:SQLName="COMPOSITEID"/>
46 <xs:element name="title" type="xs:string" minOccurs="0" xdb:SQLName="TITLE"/>
47 <xs:element name="description" type="xs:string" minOccurs="0" xdb:SQLName="DESCRIPTION"/>
48 <xs:element name="corequisite" type="CompositeIDType" minOccurs="0" maxOccurs="unbounded" xdb:SQLName="COREQUISITE"
xdb:defaultTable=""/>
49 <xs:element name="prerequisite" type="CompositeIDType" minOccurs="0" maxOccurs="unbounded" xdb:SQLName="PREREQUISITE
" xdb:defaultTable=""/>
50 <xs:element name="availability" minOccurs="0" xdb:SQLName="AVAILABILITY">
51 <xs:complexType>
52 <xs:sequence>
53 <xs:element name="startDate" type="xs:date" minOccurs="0" xdb:SQLName="STARTDATE"/>
54 <xs:element name="endDate" type="xs:date" minOccurs="0" xdb:SQLName="ENDDATE"/>
55 </xs:sequence>
56 </xs:complexType>
57 </xs:element>
58 </xs:sequence>
59 </xs:complexType>
60 <xs:complexType name="ListOfCourseType" xdb:SQLType="COURSE_LIST_T">
61 <xs:sequence minOccurs="0" maxOccurs="unbounded">
62 <xs:element name="id" type="xs:positiveInteger" minOccurs="0" xdb:SQLName="ID"/>
63 <xs:element ref="course" minOccurs="0"/>
64 </xs:sequence>
65 </xs:complexType>
66 <xs:complexType name="CourseCatalogType" xdb:SQLType="COURSE_CATALOG_T">
67 <xs:sequence minOccurs="0">
68 <xs:element name="id" type="xs:positiveInteger" minOccurs="0" xdb:SQLName="ID"/>
69 <xs:element ref="listOfCourse" minOccurs="0"/>
70 </xs:sequence>
71 </xs:complexType>
72 </xs:schema>');
73 begin
74 if (dbms_xdb.existsResource(:schemaPath)) then
75 dbms_xdb.deleteResource(:schemaPath);
76 end if;
77 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
78 end;
79 /
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> begin
2 :schemaURL := 'http://aahmb10-147:7575/public/www.mdanderson.org/schema/APEP/academicProgram.xsd';
3 :schemaPath := '/public/academicProgram.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
2 /
Call completed.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<?xml version="1.0" encoding="WINDOWS-1252"?>
5 <!-- edited with XMLSpy v2006 rel. 3 U (http://www.altova.com) by John Grossman (UT MD Anderson Cancer Center) -->
6 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:ap="http://www.mdanderson.org/sche
ma/APEP/courseCatalog" targetNamespace="http://www.mdanderson.org/schema/APEP/courseCatalog" elementFormDefault="qualified" attributeFormDef
ault="unqualified" xdb:storeVarrayAsTable="true">
7 <xs:include schemaLocation="http://aahmb10-147:7575/public/www.mdanderson.org/schema/APEP/courseCatalog.xsd" />
8 <!-- ######################################## -->
9 <!-- GLOBAL ELEMENTS -->
10 <!-- ######################################## -->
11 <xs:element name="academicProgram" type="ap:AcademicProgramType" xdb:defaultTable="ACADEMICPROGRAM">
12 <xs:annotation>
13 <xs:documentation>Comment describing your root element</xs:documentation>
14 </xs:annotation>
15 </xs:element>
16 <!-- ######################################## -->
17 <!-- GLOBAL Types -->
18 <!-- ######################################## -->
19 <xs:complexType name="ListOfAcademicCredentialType" xdb:SQLType="ACADEMICCREDENTIAL_LIST_T">
20 <xs:sequence minOccurs="0" maxOccurs="unbounded">
21 <xs:element name="credential" type="ap:AcademicCredentialType" minOccurs="0" xdb:SQLName="CREDENTIAL"/>
22 </xs:sequence>
23 </xs:complexType>
24 <xs:complexType name="AcademicCredentialType" xdb:SQLType="ACADEMICCREDENTIAL_T">
25 <xs:sequence minOccurs="0">
26 <xs:element name="id" type="xs:integer" minOccurs="0" xdb:SQLName="ID"/>
27 <xs:element name="field" type="xs:string" minOccurs="0" xdb:SQLName="FIELD">
28 <xs:annotation>
29 <xs:documentation>Academic or professional field for which the credential is granted. Example: Clini
ical Laboratory Science</xs:documentation>
30 </xs:annotation>
31 </xs:element>
32 <xs:element name="typeCode" minOccurs="0" xdb:SQLName="TYPECODE">
33 <xs:annotation>
34 <xs:documentation>The type of credential. Example: Bachelor of Science</xs:documentation>
35 </xs:annotation>
36 <xs:simpleType>
37 <xs:restriction base="xs:string">
38 <xs:enumeration value="Bachelor of Science Degree"/>
39 <xs:enumeration value="Certificate"/>
40 </xs:restriction>
41 </xs:simpleType>
42 </xs:element>
43 </xs:sequence>
44 </xs:complexType>
45 <xs:complexType name="RequirementType" xdb:SQLType="ACADEMICPROGRAM_REQ_T">
46 <xs:sequence minOccurs="0">
47 <xs:element name="typeCode" type="xs:string" minOccurs="0" xdb:SQLName="TYPECODE"/>
48 <xs:element name="description" type="xs:string" minOccurs="0" xdb:SQLName="DESCRIPTION"/>
49 <xs:element name="scope" type="xs:string" minOccurs="0" xdb:SQLName="SCOPE"/>
50 </xs:sequence>
51 </xs:complexType>
52 <xs:complexType name="ListOfRequirementType" xdb:SQLType="ACADEMICPROGRAM_REQ_L_T">
53 <xs:sequence minOccurs="0">
54 <xs:element name="requirement" type="ap:RequirementType" minOccurs="0" xdb:SQLName="REQUIREMENT"/>
55 </xs:sequence>
56 </xs:complexType>
57 <xs:complexType name="AcademicProgramType" xdb:SQLType="ACADEMICPROGRAM_T">
58 <xs:sequence>
59 <xs:element name="name" type="xs:string" minOccurs="0" xdb:SQLName="NAME"/>
60 <xs:element name="description" type="xs:string" minOccurs="0" xdb:SQLName="DESCRIPTION"/>
61 <xs:element name="listOfAcademicCredential" type="ap:ListOfAcademicCredentialType" minOccurs="0"/>
62 <xs:element name="listOfRelatedParty" minOccurs="0" xdb:SQLName="LISTOFRELATEDPARTY"/>
63 <xs:element name="mission" type="xs:string" minOccurs="0" xdb:SQLName="MISSION"/>
64 <xs:element name="goals" type="xs:string" minOccurs="0" xdb:SQLName="GOAL"/>
65 <xs:element name="objectives" type="xs:string" minOccurs="0" xdb:SQLName="OBJECTIVES"/>
66 <xs:element name="competencies" minOccurs="0" xdb:SQLName="COMPETENCIES"/>
67 <xs:element name="selectionProcess" minOccurs="0" xdb:SQLName="SELECTIONPROCESS"/>
68 <xs:element name="listOfRequirement" type="ap:ListOfRequirementType" minOccurs="0"/>
69 <xs:element name="evaluationCriteria" minOccurs="0" xdb:SQLName="EVALUATIONCRITERIA"/>
70 <xs:element name="postBaccDegreeInfo" minOccurs="0" xdb:SQLName="POSTBACCDEGREEINFO"/>
71 <xs:element name="postBaccCertificateInfo" minOccurs="0" xdb:SQLName="POSTBACCCERTIFICATEINFO"/>
72 <xs:element name="advancedPlacement" minOccurs="0" xdb:SQLName="ADVANCEDPLACEMENT"/>
73 <xs:element name="graduation" minOccurs="0" xdb:SQLName="GRADUATION"/>
74 <xs:element name="curriculum" minOccurs="0" xdb:SQLName="CURRICULUM"/>
75 <xs:element name="listOfCourse" type="ap:ListOfCourseType" minOccurs="0" xdb:SQLName="LISTOFCOURSE"/>
76 </xs:sequence>
77 </xs:complexType>
78 </xs:schema>
79 ');
80 begin
81 if (dbms_xdb.existsResource(:schemaPath)) then
82 dbms_xdb.deleteResource(:schemaPath);
83 end if;
84 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
85 end;
86 /
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> insert into COURSE values ( xmltype(
2 '<?xml version="1.0" encoding="WINDOWS-1252"?>
3 <?altova_sps http://aahmb10-147:7575/public/www.mdanderson.org/template/APEP/courseInput.sps?>
4 <course xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog" xmlns:ns1="http://www.mdanderson.org/schema/APEP/custom" xmlns:xdb=
"http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mdanderson.org/schema/APE
P/courseCatalog http://aahmb10-147:7575/public/www.mdanderson.org/schema/APEP/courseCatalog.xsd">
5 <id>53</id>
6 <compositeID>
7 <prefix>CL</prefix>
8 <level>4</level>
9 <creditHours>1</creditHours>
10 <identNumber>05</identNumber>
11 </compositeID>
12 <title>Urinalysis </title>
13 <description>A review of the anatomy and physiology of the kidney and the formation, elimination, and composition of urine and body flu
ids. Interpretation of urinary elements, chemical assays, and the correlation with normal and abnormal physiology.</description>
14 </course>'))
15 /
1 row created.
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | INSERT STATEMENT | | 1 | 100 | 1 (0)| 00:00:01 |
SQL> insert into COURSE values ( xmltype(
2 '<?xml version="1.0" encoding="WINDOWS-1252"?>
3 <?altova_sps http://aahmb10-147:7575/public/www.mdanderson.org/template/APEP/courseInput.sps?>
4 <course xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog" xmlns:ns1="http://www.mdanderson.org/schema/APEP/custom" xmlns:xdb=
"http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mdanderson.org/schema/APE
P/courseCatalog http://aahmb10-147:7575/public/www.mdanderson.org/schema/APEP/courseCatalog.xsd">
5 <id>54</id>
6 <compositeID>
7 <prefix>CL</prefix>
8 <level>4</level>
9 <creditHours>1</creditHours>
10 <identNumber>05</identNumber>
11 </compositeID>
12 <title>Course 54</title>
13 <description>A review of the anatomy and physiology of the kidney and the formation, elimination, and composition of urine and body flu
ids. Interpretation of urinary elements, chemical assays, and the correlation with normal and abnormal physiology.</description>
14 </course>'))
15 /
1 row created.
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | INSERT STATEMENT | | 1 | 100 | 1 (0)| 00:00:01 |
SQL> insert into COURSE values ( xmltype(
2 '<?xml version="1.0" encoding="WINDOWS-1252"?>
3 <?altova_sps http://aahmb10-147:7575/public/www.mdanderson.org/template/APEP/courseInput.sps?>
4 <course xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog" xmlns:ns1="http://www.mdanderson.org/schema/APEP/custom" xmlns:xdb=
"http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mdanderson.org/schema/APE
P/courseCatalog http://aahmb10-147:7575/public/www.mdanderson.org/schema/APEP/courseCatalog.xsd">
5 <id>55</id>
6 <compositeID>
7 <prefix>CL</prefix>
8 <level>4</level>
9 <creditHours>1</creditHours>
10 <identNumber>05</identNumber>
11 </compositeID>
12 <title>Course 55</title>
13 <description>A review of the anatomy and physiology of the kidney and the formation, elimination, and composition of urine and body flu
ids. Interpretation of urinary elements, chemical assays, and the correlation with normal and abnormal physiology.</description>
14 </course>'))
15 /
1 row created.
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | INSERT STATEMENT | | 1 | 100 | 1 (0)| 00:00:01 |
SQL> insert into ACADEMICPROGRAM values ( xmltype (
2 '<?xml version="1.0" encoding="WINDOWS-1252"?>
3 <!--Sample XML file generated by XMLSpy v2006 rel. 3 U (http://www.altova.com)-->
4 <academicProgram xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog" xmlns:ns1="http://www.mdanderson.org/schema/APEP/custom" x
mlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mdanderson.org/s
chema/APEP/courseCatalog http://aahmb10-147:7575/public/www.mdanderson.org/schema/APEP/academicProgram.xsd">
5 <name>Clinical Laboratory Science</name>
6 <description>The clinical laboratory scientist is an essential member of the health care team, performing a myriad of laboratory proc
edures aimed at the diagnosis and treatment of disease.</description>
7 <listOfAcademicCredential>
8 <credential>
9 <id>0</id>
10 <field>String</field>
11 <typeCode>Bachelor of Science Degree</typeCode>
12 </credential>
13 <credential>
14 <id>0</id>
15 <field>String</field>
16 <typeCode>Bachelor of Science Degree</typeCode>
17 </credential>
18 <credential>
19 <id>0</id>
20 <field>String</field>
21 <typeCode>Bachelor of Science Degree</typeCode>
22 </credential>
23 </listOfAcademicCredential>
24 <listOfRelatedParty xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
25 <mission>String</mission>
26 <goals>String</goals>
27 <objectives>String</objectives>
28 <competencies xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
29 <selectionProcess xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
30 <listOfRequirement>
31 <requirement>
32 <typeCode>String</typeCode>
33 <description>String</description>
34 <scope>String</scope>
35 </requirement>
36 </listOfRequirement>
37 <evaluationCriteria xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
38 <postBaccDegreeInfo xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
39 <postBaccCertificateInfo xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
40 <advancedPlacement xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
41 <graduation xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
42 <curriculum xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
43 <listOfCourse>
44 <id>53</id>
45 <course>
46 <id>53</id>
47 <compositeID>
48 <prefix>CL</prefix>
49 <level>4</level>
50 <creditHours>1</creditHours>
51 <identNumber>05</identNumber>
52 </compositeID>
53 <title>Biochemistry</title>
54 <description>this is a test for the course biochemistry</description>
55 </course>
56 <course>
57 <id>55</id>
58 <compositeID>
59 <prefix>CL</prefix>
60 <level>4</level>
61 <creditHours>1</creditHours>
62 <identNumber>05</identNumber>
63 </compositeID>
64 <title>Something Else</title>
65 <description>this is a test for the course biochemistry</description>
66 </course>
67 </listOfCourse>
68 </academicProgram>'))
69 /
1 row created.
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | INSERT STATEMENT | | 1 | 100 | 1 (0)| 00:00:01 |
SQL> select extractValue(value(c),'/course/id')
2 from ACADEMICPROGRAM ap,
3 table (xmlsequence(extract(value(ap),'/academicProgram/listOfCourse/course','xmlns="http://www.mdanderson.org/schema/APEP/courseCatalo
g"'))) c
4 /
53
55
Execution Plan
Plan hash value: 3351541143
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 2 | 126 | 804 (0)| 00:00:10 |
| 1 | NESTED LOOPS | | 2 | 126 | 804 (0)| 00:00:10 |
|* 2 | INDEX FAST FULL SCAN | SYS_IOT_TOP_177341 | 2 | 66 | 802 (0)| 00:00:10 |
|* 3 | TABLE ACCESS BY INDEX ROWID| ACADEMICPROGRAM | 1 | 30 | 1 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | SYS_C0022632 | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - filter("SYS_NC_TYPEID$" IS NOT NULL)
3 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype('<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-ins
tance" 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-properti
es/><read-contents/></privilege>'))=1)
4 - access("NESTED_TABLE_ID"="ACADEMICPROGRAM"."SYS_NC0004200043$")
Note
- dynamic sampling used for this statement
SQL> select updateXML
2 (
3 ap.object_value,
4 '/academicProgram/listOfCourse',
5 ( select xmlelement
6 (
7 "listOfCourse",
8 xmlattributes('http://www.mdanderson.org/schema/APEP/courseCatalog' as "xmlns"),
9 ( select xmlagg ( xmlconcat(extract(object_value,'/course/id'), extract(object_value,'/course')) )
10 from course c,
11 table (xmlsequence(extract(ap.object_value,'/academicProgram/listOfCourse/course','xmlns="http://www.mdanders
on.org/schema/APEP/courseCatalog"'))) api
12 where extractValue(c.object_value,'/course/id') = extractValue(value(api),'/course/id')
13 )
14 ) from dual
15 ),
16 'xmlns:="http://www.mdanderson.org/schema/APEP/courseCatalog"'
17 )
18 from ACADEMICPROGRAM ap
19 /
<?xml version="1.0" encoding="WINDOWS-1252"?>
<!--Sample XML file generated by XMLSpy v2006 rel. 3 U (http://www.altova.com)--><academicProgram xmlns="http://www.mdanderson.org/schema/AP
EP/courseC
atalog" xmlns:ns1="http://www.mdanderson.org/schema/APEP/custom" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/X
MLSchema-i
nstance" xsi:schemaLocation="http://www.mdanderson.org/schema/APEP/courseCatalog http://aahmb10-147:7575/public/www.mdanderson.org/schema/AP
EP/academi
cProgram.xsd">
<name>Clinical Laboratory Science</name>
<description>The clinical laboratory scientist is an essential member of the health care team, performing a myriad of laboratory procedure
s aimed at
the diagnosis and treatment of disease.</description>
<listOfAcademicCredential>
<credential>
<id>0</id>
<field>String</field>
<typeCode>Bachelor of Science Degree</typeCode>
</credential>
<credential>
<id>0</id>
<field>String</field>
<typeCode>Bachelor of Science Degree</typeCode>
</credential>
<credential>
<id>0</id>
<field>String</field>
<typeCode>Bachelor of Science Degree</typeCode>
</credential>
</listOfAcademicCredential>
<listOfRelatedParty xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
<mission>String</mission>
<goals>String</goals>
<objectives>String</objectives>
<competencies xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
<selectionProcess xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
<listOfRequirement>
<requirement>
<typeCode>String</typeCode>
<description>String</description>
<scope>String</scope>
</requirement>
</listOfRequirement>
<evaluationCriteria xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
<postBaccDegreeInfo xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
<postBaccCertificateInfo xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
<advancedPlacement xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
<graduation xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
<curriculum xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog"/>
<listOfCourse xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog">
<id xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog">53</id>
<course xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog" xmlns:ns1="http://www.mdanderson.org/schema/APEP/custom" xmlns:xdb="
http://xml
ns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mdanderson.org/schema/APEP/courseCat
alog http:
//aahmb10-147:7575/public/www.mdanderson.org/schema/APEP/courseCatalog.xsd">
<id>53</id>
<compositeID>
<prefix>CL</prefix>
<level>4</level>
<creditHours>1</creditHours>
<identNumber>05</identNumber>
</compositeID>
<title>Urinalysis </title>
<description>A review of the anatomy and physiology of the kidney and the formation, elimination, and composition of urine and body fl
uids. Inte
rpretation of urinary elements, chemical assays, and the correlation with normal and abnormal physiology.</description>
</course>
<id xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog">55</id>
<course xmlns="http://www.mdanderson.org/schema/APEP/courseCatalog" xmlns:ns1="http://www.mdanderson.org/schema/APEP/custom" xmlns:xdb="
http://xml
ns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mdanderson.org/schema/APEP/courseCat
alog http:
//aahmb10-147:7575/public/www.mdanderson.org/schema/APEP/courseCatalog.xsd">
<id>55</id>
<compositeID>
<prefix>CL</prefix>
<level>4</level>
<creditHours>1</creditHours>
<identNumber>05</identNumber>
</compositeID>
<title>Course 55</title>
<description>A review of the anatomy and physiology of the kidney and the formation, elimination, and composition of urine and body fl
uids. Inte
rpretation of urinary elements, chemical assays, and the correlation with normal and abnormal physiology.</description>
</course>
</listOfCourse>
</academicProgram>
Execution Plan
Plan hash value: 1698158615
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 47932 | 3 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 13818 | | |
|* 2 | HASH JOIN | | 1 | 13818 | 5 (20)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | SYS_IOT_TOP_177341 | 1 | 33 | 2 (0)| 00:00:01 |
|* 4 | TABLE ACCESS FULL| COURSE | 3 | 41355 | 3 (0)| 00:00:01 |
| 5 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
|* 6 | TABLE ACCESS FULL | ACADEMICPROGRAM | 1 | 47932 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("COURSE"."SYS_NC00009$"="ID")
3 - access("NESTED_TABLE_ID"=:B1)
filter("SYS_NC_TYPEID$" IS NOT NULL)
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)
6 - 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)
Note
- dynamic sampling used for this statement
SQL> -
How to create a relational view base on an xmltype table which included sev
Hi,
I am using oracle 11.2.0.1.0.
how to create a relational view base on an xmltype table which content several different .xml files?
Thanks.
for examle:
SQL> SELECT OBJECT_VALUE FROM document;
Edited by: Cow on Jan 6, 2011 7:57 PMFor example I already have these three xml files inserted into the document xmltype table.
These xml files have same schemas. I have attached below.
I want to show all elements/attribute values in xml files to relational view.
Is this possible to create one big relational view to show everything
or I have to create three separate relation views then use UNION to put together? Thanks a lot. Cow
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
<document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd">
<id root="5ca4e3cb-7298-4948-8cc2-58e71ad32694"/>
</component>
</document>
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
<document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd">
</component>
</document>
Edited by: Cow on Jan 4, 2011 9:51 AM -
How to improve performance of a query that is based on an xmltype table
Dear Friends,
I have a query that is pulling records from an xmltype table with 9000 rows and it is running very slow.
I am using XMLTABLE command to retreive the rows. It is taking upto 30 minutes to finish.
Would you be able to suggest how I can make it faster. Thanks.
Below is the query.....
INSERT INTO temp_sap_po_receipt_history_t
(po_number, po_line_number, doc_year,
material_doc, material_doc_item, quantity, sap_ref_doc_no_long,
reference_doc, movement_type_code,
sap_ref_doc_no, posting_date, entry_date, entry_time, hist_type)
SELECT :pin_po_number po_number,
b.po_line_number, b.doc_year,
b.material_doc, b.material_doc_item, b.quantity, b.sap_ref_doc_no_long,
b.reference_doc, b.movement_type_code,
b.sap_ref_doc_no, to_date(b.posting_date,'rrrr-mm-dd'),
to_date(b.entry_date,'rrrr-mm-dd'), b.entry_time, b.hist_type
FROM temp_xml t,
XMLTABLE(XMLNAMESPACES('urn:sap-com:document:sap:rfc:functions' AS "n0"),
'/n0:BAPI_PO_GETDETAIL1Response/POHISTORY/item'
PASSING t.object_value
COLUMNS PO_LINE_NUMBER VARCHAR2(20) PATH 'PO_ITEM',
DOC_YEAR varchar2(4) PATH 'DOC_YEAR',
MATERIAL_DOC varchar2(30) PATH 'MAT_DOC',
MATERIAL_DOC_ITEM VARCHAR2(10) PATH 'MATDOC_ITEM',
QUANTITY NUMBER(20,6) PATH 'QUANTITY',
SAP_REF_DOC_NO_LONG VARCHAR2(20) PATH 'REF_DOC_NO_LONG',
REFERENCE_DOC VARCHAR2(20) PATH 'REF_DOC',
MOVEMENT_TYPE_CODE VARCHAR2(4) PATH 'MOVE_TYPE',
SAP_REF_DOC_NO VARCHAR2(20) PATH 'REF_DOC_NO',
POSTING_DATE VARCHAR2(10) PATH 'PSTNG_DATE',
ENTRY_DATE VARCHAR2(10) PATH 'ENTRY_DATE',
ENTRY_TIME VARCHAR2(8) PATH 'ENTRY_TIME',
HIST_TYPE VARCHAR2(5) PATH 'HIST_TYPE') b;Based on response from mdrake on this thread:
Re: XML file processing into oracle
For large XML's, you can speed up the processing of XMLTABLE by using a registered schema...
declare
SCHEMAURL VARCHAR2(256) := 'http://xmlns.example.org/xsd/testcase.xsd';
XMLSCHEMA VARCHAR2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
<xs:element name="cust_order" type="cust_orderType" xdb:defaultTable="CUST_ORDER_TBL"/>
<xs:complexType name="groupType" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="item" type="itemType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" type="xs:byte" use="required"/>
</xs:complexType>
<xs:complexType name="itemType" xdb:maintainDOM="false">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:short" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="cust_orderType" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="group" type="groupType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="cust_id" type="xs:short" use="required"/>
</xs:complexType>
</xs:schema>';
INSTANCE CLOB :=
'<cust_order cust_id="12345">
<group id="1">
<item id="1" name="Standard Mouse">100</item>
<item id="2" name="Keyboard">100</item>
<item id="3" name="Memory Module 2Gb">200</item>
<item id="4" name="Processor 3Ghz">25</item>
<item id="5" name="Processor 2.4Ghz">75</item>
</group>
<group id="2">
<item id="1" name="Graphics Tablet">15</item>
<item id="2" name="Keyboard">15</item>
<item id="3" name="Memory Module 4Gb">15</item>
<item id="4" name="Processor Quad Core 2.8Ghz">15</item>
</group>
<group id="3">
<item id="1" name="Optical Mouse">5</item>
<item id="2" name="Ergo Keyboard">5</item>
<item id="3" name="Memory Module 2Gb">10</item>
<item id="4" name="Processor Dual Core 2.4Ghz">5</item>
<item id="5" name="Dual Output Graphics Card">5</item>
<item id="6" name="28inch LED Monitor">10</item>
<item id="7" name="Webcam">5</item>
<item id="8" name="A3 1200dpi Laser Printer">2</item>
</group>
</cust_order>';
begin
dbms_xmlschema.registerSchema
schemaurl => SCHEMAURL
,schemadoc => XMLSCHEMA
,local => TRUE
,genTypes => TRUE
,genBean => FALSE
,genTables => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
execute immediate 'insert into CUST_ORDER_TBL values (XMLTYPE(:INSTANCE))' using INSTANCE;
end;
SQL> desc CUST_ORDER_TBL
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.org/xsd/testcase.xsd" Element "cust_order") STORAGE Object-relational TYPE "cust_orderType222_T"
SQL> set autotrace on explain
SQL> set pages 60 lines 164 heading on
SQL> col cust_id format a8
SQL> select extract(object_value,'/cust_order/@cust_id') as cust_id
2 ,grp.id as group_id, itm.id as item_id, itm.inm as item_name, itm.qty as item_qty
3 from CUST_ORDER_TBL
4 ,XMLTABLE('/cust_order/group'
5 passing object_value
6 columns id number path '@id'
7 ,item xmltype path 'item'
8 ) grp
9 ,XMLTABLE('/item'
10 passing grp.item
11 columns id number path '@id'
12 ,inm varchar2(30) path '@name'
13 ,qty number path '.'
14 ) itm
15 /
CUST_ID GROUP_ID ITEM_ID ITEM_NAME ITEM_QTY
12345 1 1 Standard Mouse 100
12345 1 2 Keyboard 100
12345 1 3 Memory Module 2Gb 200
12345 1 4 Processor 3Ghz 25
12345 1 5 Processor 2.4Ghz 75
12345 2 1 Graphics Tablet 15
12345 2 2 Keyboard 15
12345 2 3 Memory Module 4Gb 15
12345 2 4 Processor Quad Core 2.8Ghz 15
12345 3 1 Optical Mouse 5
12345 3 2 Ergo Keyboard 5
12345 3 3 Memory Module 2Gb 10
12345 3 4 Processor Dual Core 2.4Ghz 5
12345 3 5 Dual Output Graphics Card 5
12345 3 6 28inch LED Monitor 10
12345 3 7 Webcam 5
12345 3 8 A3 1200dpi Laser Printer 2
17 rows selected.Need at least 10.2.0.3 for performance i.e. to avoid COLLECTION ITERATOR PICKLER FETCH in execution plan...
On 10.2.0.1:
Execution Plan
Plan hash value: 3741473841
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 24504 | 89M| 873 (1)| 00:00:11 |
| 1 | NESTED LOOPS | | 24504 | 89M| 873 (1)| 00:00:11 |
| 2 | NESTED LOOPS | | 3 | 11460 | 805 (1)| 00:00:10 |
| 3 | TABLE ACCESS FULL | CUST_ORDER_TBL | 1 | 3777 | 3 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | SYS_IOT_TOP_774117 | 3 | 129 | 1 (0)| 00:00:01 |
| 5 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | | | | |
Predicate Information (identified by operation id):
4 - access("NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
filter("SYS_NC_TYPEID$" IS NOT NULL)
Note
- dynamic sampling used for this statementOn 10.2.0.3:
Execution Plan
Plan hash value: 1048233240
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 17 | 132K| 839 (0)| 00:00:11 |
| 1 | NESTED LOOPS | | 17 | 132K| 839 (0)| 00:00:11 |
| 2 | MERGE JOIN CARTESIAN | | 17 | 131K| 805 (0)| 00:00:10 |
| 3 | TABLE ACCESS FULL | CUST_ORDER_TBL | 1 | 3781 | 3 (0)| 00:00:01 |
| 4 | BUFFER SORT | | 17 | 70839 | 802 (0)| 00:00:10 |
|* 5 | INDEX FAST FULL SCAN| SYS_IOT_TOP_56154 | 17 | 70839 | 802 (0)| 00:00:10 |
|* 6 | INDEX UNIQUE SCAN | SYS_IOT_TOP_56152 | 1 | 43 | 2 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | SYS_C006701 | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
5 - filter("SYS_NC_TYPEID$" IS NOT NULL)
6 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
w5Ysl6x9w=="."SYS_NC0000600007$")
filter("SYS_NC_TYPEID$" IS NOT NULL AND
"NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
7 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
w5Ysl6x9w=="."SYS_NC0000600007$")
Note
- dynamic sampling used for this statement----------------------------------------------------------------------------------------------------------
-- CLEAN UP
DROP TABLE CUST_ORDER_TBL purge;
exec dbms_xmlschema.deleteschema('http://xmlns.example.org/xsd/testcase.xsd'); -
How to create view for xmltype table in oracle
hi:
Can some one help me how to create view for xmltype table in oracle?
XMLType do not have column
SemThank you !!
I read it and become very hard to implement what I want to do.
Can you give me example please?
My main goal to create view for xmltype table is to XQuery the XML data?
Do you have any other suggestion?
Please help
Ali_2 -
How to create XMLTYPE View from the XMLType table
Hi:
I have a large XML file and inserted to the XMLTYPE table
For the XQUERY purpose I would like to create XMLView of the table.
The examples I got from Oracle to create XML view are for small files.
Can some one help me how to create XMLType VIEW for large XML Files ( 20,000 lines )?
Ali_2Have a look at the examples given on XMLType Views (based on relational tables) or standard views (based on XMLType storage) in the FAQ url located on the main page of this forum site regarding XMLDB.
-
How to delete an .xml file from xmltype table?
Hi expert,
I am in I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 22 11:40:23 2011
I have inserted 3 .xml files into an xmltype table: DOCUMENT
SQL> SELECT OBJECT_VALUE FROM document;
OBJECT_VALUE
<?xml version="1.0" encoding="WINDOWS-1252"?>
<?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
<document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoc
ation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd" classCode="DOC">
<id root="5ca4e3cb-7298-4948-8cc2-58e71ad32694"/>
<code code="51725-0" c
<?xml version="1.0" encoding="WINDOWS-1252"?>
<?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
<document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoc
ation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd" classCode="DOC">
<id root="03d6a2cd-fdda-4fe1-865d-da0db9212f34"/>
<code code="51725-0" c
<?xml version="1.0" encoding="WINDOWS-1252"?>
<?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
<document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoc
ation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd" classCode="DOC">
<id root="09ff06d6-8b85-43dd-b5cc-e22d00f02bd0"/>
<code code="51725-0" c
I tried to delete one xml file which with id root="03d6a2cd-fdda-4fe1-865d-da0db9212f34'
delete from DOCUMENT
where xmlexists('$p/document/id[@root="03d6a2cd-fdda-4fe1-865d-da0db9212f34"]'PASSING OBJECT_VALUE AS "p");
but failed.
Is there any expert can help?
Thanks a lot!
Cow
Edited by: Cow on Mar 11, 2011 7:02 PMHi,
Namespace issue.
You have to declare it in the XQuery prolog :
DELETE FROM document
WHERE XMLExists( 'declare default element namespace "urn:hl7-org:v3"; (::)
$p/document/id[@root=$root_value]'
passing object_value as "p",
'03d6a2cd-fdda-4fe1-865d-da0db9212f34' as "root_value" )
; -
Hi all experts,
I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 22 11:40:23 2011
is there anyone know why
SQL> create or replace directory XMLDIR as '/xdb/faq/testdata'
2 /
SQL> set long 10000 pages 200 lines 150
SQL> --
SQL> select xmltype(bfilename('XMLDIR','2003.xml'),nls_charset_id('AL32UTF8'))
2 from dual
worked. but
SQL> create or replace directory XMLDIR as 'C:\Drag_list\Modified';
SQL> select xmltype(bfilename('XMLDIR','2011.xml'),nls_charset_id('AL32UTF8'))
from dual
did not work?
IS there any way I can load the .xml file list from 'C:\Drag_list\Modified' into xmltype table?
Thanks.
Edited by: Cow on Apr 13, 2011 12:58 AMThis is a question better suited for the sql and pl/sql support forum, since it is NOT an APEX based question..: PL/SQL
Thank you,
Tony Miller
Webster, TX
On the road of life...There are 'windshields', and there are 'bugs'
(splat!)
"Squeegees Wanted"
If this question is answered, please mark the thread as closed and assign points where earned.. -
Insert XML file into Relational database model without using XMLTYPE tables
Dear all,
How can I store a known complex XML file into an existing relational database WITHOUT using xmltypes in the database ?
I read the article on DBMS_XMLSTORE. DBMS_XMLSTORE indeed partially bridges the gap between XML and RDBMS to a certain extent, namely for simply structured XML (canonical structure) and simple tables.
However, when the XML structure will become arbitrary and rapidly evolving, surely there must be a way to map XML to a relational model more flexibly.
We work in a java/Oracle10 environment that receives very large XML documents from an independent data management source. These files comply with an XML schema. That is all we know. Still, all these data must be inserted/updated daily in an existing relational model. Quite an assignment isn't it ?
The database does and will not contain XMLTYPES, only plain RDBMS tables.
Are you aware of a framework/product or tool to do what DBMS_XMLSTORE does but with any format of XML file ? If not, I am doomed.
Constraints : Input via XML files defined by third party
Storage : relational database model with hundreds of tables and thousands of existing queries that can not be touched. The model must not be altered.
Target : get this XML into the database on a daily basis via an automated process.
Cheers.
Luc.Luc,
your Doomed !
If you would try something like DBMS_XMLSTORE, you probably would be into serious performance problems in your case, very fast, and it would be very difficult to manage.
If you would use a little bit of XMLType stuff, you would be able to shred the data into the relational model very fast and controlable. Take it from me, I am one of those old geezers like Mr. Tom Kyte way beyond 40 years (still joking). No seriously. I started out as a classical PL/SQL, Forms Guy that switched after two years to become a "DBA 1.0" and Mr Codd and Mr Date were for years my biggest hero's. I have the utmost respect for Mr. Tom Kyte for all his efforts for bringing the concepts manual into the development world. Just to name some off the names that influenced me. But you will have to work with UNSTRUCTURED data (as Mr Date would call it). 80% of the data out there exists off it. Stuff like XMLTABLE and XML VIEWs bridge the gap between that unstructured world and the relational world. It is very doable to drag and drop an XML file into the XMLDB database into a XMLtype table and or for instance via FTP. From that point on it is in the database. From there you could move into relational tables via XMLTABLE methods or XML Views.
You could see the described method as a filtering option so XML can be transformed into relational data. If you don't want any XML in your current database, then create an small Oracle database with XML DB installed (if doable 11.1.0.7 regarding the best performance --> all the new fast optimizer stuff etc). Use that database as a staging area that does all the XML shredding for you into relational components and ship the end result via database links and or materialized views or other probably known methodes into your relational database that isn't allowed to have XMLType.
This way you would keep your realtional Oracle database clean and have the Oracle XML DB staging database do all the filtering and shredding into relational components.
Throwing the XML DB option out off the window beforehand would be like replacing your Mercedes with a bicycle. With both you will be able to travel the distance from Paris to Rome, but it will take you a hell of lot longer.
:-) -
hi,
I have two xmltype tables(eg. testTableSB and testTableNSB), first one is schema-based(conforms to schemaA) and the other one is non-schema-based.
So the default storage will be object-relational and CLOB respectively.
I load the same xml document in both the tables. Each table has one row only(suppose).
Later I use the update statement with updateXML() in RHS as following:
update testTableSB x
set value(x)=updatexml(value(x),'/Company/Person[2]/@Degree','PHD');
update testTableNSB x
set value(x)=updatexml(value(x),'/Company/Person[2]/@Degree','BA');
Both updates work. From the documentation, I came to know that in the first table it only updates the node or attribute value whereas in the second update, the whole document is repalced because it is CLOB based.
My confusion is in the second update since it seems updating (in this case) only the attribute value.
Please suggest.
One more question, how to check whether the storage option for the table is object-relational or CLOB. One option is to describe the table. In this way, it gives info for object-relational only not for CLOB. what is the other way to check it? Any data_dictionary table?
SQL> create table testTableNSB of XMLType;
Table created.
SQL> describe testTableNSB;
Name Null? Type
TABLE of XMLTYPE
Thanking in advance.Hi
I as wrote I never tested this possibility... therefore I did the following test.
A table contains the following XML data:
SQL> select extract(value(o), '/optw/person')
2 from optw1_or_ot o
3 where existsnode(value(o), '/optw/person[@id=5]') = 1;
EXTRACT(VALUE(O),'/OPTW/PERSON')
<person id="5">
<lastname>String</lastname>
<firstname>String</firstname>
<sex>F</sex>
</person>
If I access the underlying structure, the query looks like this (notice that birthday is NULL):
SQL> select x.id, x.lastname, x.firstname, x.birthday, x.sex
2 from optw1_or_ot o, table(o.xmldata.persons) x
3 where x.id = 5;
ID LASTNAME FIRSTNAME BIRTHDAY SEX
5 String String F
If I update the data, it seams to work...
SQL> update table(select o.xmldata.persons
2 from optw1_or_ot o, table(o.xmldata.persons) x
3 where x.id = 5) t
4 set t.birthday = sysdate;
1 row updated.
SQL> select x.id, x.lastname, x.firstname, x.birthday, x.sex
2 from optw1_or_ot o, table(o.xmldata.persons) x
3 where x.id = 5;
ID LASTNAME FIRSTNAME BIRTHDAY SEX
5 String String 06-FEB-04 F
But if I select the XML data again, the data isn't available...
SQL> select extract(value(o), '/optw/person')
2 from optw1_or_ot o
3 where existsnode(value(o), '/optw/person[@id=5]') = 1;
EXTRACT(VALUE(O),'/OPTW/PERSON')
<person id="5">
<lastname>String</lastname>
<firstname>String</firstname>
<sex>F</sex>
</person>
It seams that Oracle also stores "control" information in another columns.
Therefore the only way to add such an element is through the updatexml() function.
Chris -
How do I create a table that breaks for new pages?
I'm running Pages 5.5.1 on OS X Yosemite 10.10.1 and am having difficulty understanding table behavior.
Scenario 1 - I create a new file and insert a table at the top of the first (blank) page. It automatically is selected for Object Placement>Move With Text. If I add rows to this table, Pages automatically adds a new page and breaks the table so that additional cells appear on the new page. All well and good. If I change the Object Placement to Stay on Page, the second page and those cells disappear.
Scenario 2 - I create a file and first add a few lines to the top of the first page. Then, I insert a table below those lines. It is also automatically selected for Object Placement>Move With Text. When I add rows, the table does not break for the second page, but the entire table jumps to the second page. If I change the Object Placement to Stay on Page, I can then slide the table back onto page one, but as in Scenario 1 the portion of the table which would continue onto page two disappears.
So, how do I create a table that I can add to a page which is not blank (as in Scenario 2) which will break automatically onto page 2 instead of jumping, and so the rows appear on page two (not disappear as I describe above)?
Thank you for your help.The inline table is supposed to break but like most things Pages 5 it is buggy and erratic in its behavior.
Use Pages '09.
Peter -
Insert data into the xml schema-based xmltype table problem!
Hello, there,
I got problem in inserting data into the xmltype table after registered XML schema and created table. details see below:
1) xml schema:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Constantin Ilea (EMERGIS INC) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" targetNamespace="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" elementFormDefault="qualified">
<!-- ************** PART I: BEGIN SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
<xs:simpleType name="RoutingType">
<xs:restriction base="xs:string">
<xs:enumeration value="Synch"/>
<xs:enumeration value="Asynch"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="StatusType">
<xs:restriction base="xs:string">
<xs:enumeration value="ACTIVE"/>
<xs:enumeration value="VOID"/>
<xs:enumeration value="PENDING"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SenderApplicationType">
<xs:restriction base="xs:string">
<xs:enumeration value="PR"/>
<xs:enumeration value="CR"/>
<xs:enumeration value="POS"/>
<xs:enumeration value="CPP"/>
<xs:enumeration value="Other"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ServiceTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="IS"/>
<xs:enumeration value="WS"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RouteDirect">
<xs:restriction base="xs:string">
<xs:enumeration value="Request"/>
<xs:enumeration value="Reply"/>
<xs:enumeration value="None"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Indicator">
<xs:annotation>
<xs:documentation>can we also change the value to "ON" and "OFF" instead? in this way this cn be shared by all type of switch indicator</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="YES"/>
<xs:enumeration value="NO"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RuleType">
<xs:restriction base="xs:string">
<xs:enumeration value="ControlAct"/>
<xs:enumeration value="WSPolicy"/>
<xs:enumeration value="AccessControl"/>
<xs:enumeration value="Certification"/>
<xs:enumeration value="MessageConformance"/>
<xs:enumeration value="Variant"/>
<xs:enumeration value="Routing"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="HL7Result">
<xs:restriction base="xs:string">
<xs:enumeration value="ACCEPT"/>
<xs:enumeration value="REFUSE"/>
<xs:enumeration value="REJECT"/>
<xs:enumeration value="ACK"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="IIPType">
<xs:restriction base="xs:string">
<xs:enumeration value="PUT"/>
<xs:enumeration value="GET/LIST"/>
<xs:enumeration value="NOTIF"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ProfileTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="IIPProfile"/>
<xs:enumeration value="BizOperationProfile"/>
<xs:enumeration value="OrchestrationProfile"/>
<xs:enumeration value="DomainObjectProfile"/>
<xs:enumeration value="ServiceProfile"/>
<xs:enumeration value="ExceptionProfile"/>
<xs:enumeration value="CustomizedProfile"/>
<xs:enumeration value="SystemProfile"/>
<xs:enumeration value="HL7XMLSchemaProfile"/>
<xs:enumeration value="EnricherParametersProfile"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ParameterType">
<xs:restriction base="xs:string">
<xs:enumeration value="String"/>
<xs:enumeration value="Object"/>
<xs:enumeration value="Number"/>
<xs:enumeration value="Document"/>
</xs:restriction>
</xs:simpleType>
<!-- ************** PART I: END SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
<!-- ************** PART II: BEGIN COMPLEX OBJECT TYPE DEFINITIONS ********************************** -->
<!-- *********************** begin new added objects, by rshan *************************************** -->
<xs:complexType name="ProfileType">
<xs:annotation>
<xs:documentation>
1.Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
2.ProfileID used to uniquely identify the current profile
3.ProfileData used to hold all the necessary profile related data
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="ProfileID" type="ProfileIDType">
<xs:annotation>
<xs:documentation>this will hold all the common attributes, espically the global unique identifier to the profile, no matter what type of profile is</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ProfileData" type="ProfileDataType">
<xs:annotation>
<xs:documentation>all the non-common profile meta data that attached to each specific profile type such as IIPProfile, OrchestrationProfile, and BizOperationProfile will be placed here</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProfileIDType">
<xs:annotation>
<xs:documentation>global unique identifier and all the common attributes across all different profiles, the @ID and @Type together will be used as the primary key to identify the profile data</xs:documentation>
</xs:annotation>
<xs:attribute name="ID" type="xs:ID" use="required">
<xs:annotation>
<xs:documentation>ID is the global unique identifier to the profile, no matter what type of profile it is</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Name"/>
<xs:attribute name="Description"/>
<xs:attribute name="Version">
<xs:annotation>
<xs:documentation>version of the profile data</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Type" type="ProfileTypeType" use="required">
<xs:annotation>
<xs:documentation>value to identify the ProfileType type within
IIPProfile,BizOperationProfile,OrchestrationProfile,DomainObjectProfile
ServiceProfile,ExceptionProfile,SystemProfile,HL7XMLSchemaProfile,
EnricherParametersProfile,CustomizedProfile
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Status" type="StatusType" default="ACTIVE">
<xs:annotation>
<xs:documentation>used to show the related profile data status like "ACTIVE","PENDING","VOID"...</xs:documentation>
</xs:annotation>
</xs:attribute>
<!--
<xs:sequence>
<xs:element name="ProfileReference" type="ProfileIDType" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>this will be the place to hold the integrity relationship with other profiles like foreign key if existed and necessary to show up</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
-->
</xs:complexType>
<xs:complexType name="ProfileDataType">
<xs:annotation>
<xs:documentation>meta data associated tightly to each specific type of profile</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:element name="EnricherParametersProfileData" type="EnricherParametersDataType">
<xs:annotation>
<xs:documentation>Enricher Parameters related profile data
1. one instance of this type may contains all the related System metadata.
2. idType part may use to identify different version/release/status
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ExtendProfileData" type="ExtendProfileDataType">
<xs:annotation>
<xs:documentation>If needed, any profile data not defined within the current release scope can be added here </xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="ExtendProfileDataType">
<xs:sequence>
<xs:element name="ExtendProfile" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EnricherParametersDataType">
<xs:sequence>
<xs:element name="EnricherParameter" type="EnricherParameter" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EnricherParameter">
<xs:sequence>
<xs:element ref="Enricher"/>
</xs:sequence>
<xs:attribute name="serviceName" type="xs:string" use="required"/>
<xs:attribute name="interactionID" type="xs:string"/>
</xs:complexType>
<xs:element name="Enricher">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Parameters" type="Parameters"/>
<xs:element ref="Section" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="ValueType">
<xs:attribute name="field" use="required"/>
<xs:attribute name="value"/>
<xs:attribute name="action"/>
</xs:complexType>
<xs:element name="Section">
<xs:complexType>
<xs:sequence>
<xs:element name="Value" type="ValueType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="Section" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="path" use="required"/>
</xs:complexType>
</xs:element>
<xs:complexType name="Parameters">
<xs:sequence>
<xs:element name="Parameter" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" use="required"/>
<xs:attribute name="reference"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RuleList">
<xs:annotation>
<xs:documentation>an array of rules</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Rule" type="RuleProfile" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RuleProfile">
<xs:attribute name="RName" use="required"/>
<xs:attribute name="RType" type="RuleType" use="required"/>
<xs:attribute name="Status" default="ON">
<xs:annotation>
<xs:documentation>By default is ON (or if is missing)</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Order"/>
<xs:attribute name="Direction" type="RouteDirect">
<xs:annotation>
<xs:documentation>Request / Reply</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ************** PART II: END COMPLEX OBJECT TYPE DEFINITIONS *********************************** -->
<!-- ************** PART III: BEGIN ROOT ELEMENTS DEFINITIONS ********************************* -->
<!-- 0) Profile wrapper root element
Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
-->
<xs:element name="Profile" type="ProfileType">
<xs:annotation>
<xs:documentation>Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
2)register xml schema:
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 schemaurl=>'http://rac3-1-vip:8080/home/'||USER||'/xsd/EHIPProfile_v00.xsd',
5 schemadoc=>xdbURIType('/home/'||USER||'/xsd/EHIPProfile_v00.xsd').getClob(),
6 local=>True,
7 gentypes=>True,
8 genbean=>False,
9 gentables=>False
10 );
11 End;
12 /
PL/SQL procedure successfully completed.
SQL>
SQL>
3) xml data:
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
<Profile xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1">
<ProfileID Type="EnricherParametersProfile" Status="ACTIVE" ID="EnricherPP.ID.0001" Name="EnricherPP.ID.0001" Description="EnricherPP.ID.0001" Version="01"/>
<ProfileData>
<EnricherParametersProfileData>
<EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.ExceptionCreators:createExceptionV50CategoryCanonicalPart" interactionID="">
<Enricher>
<Parameters>
<Parameter name="MESSAGE_ID" reference="test"/>
</Parameters>
<Section path="HEADER">
<Section path="RESPONSE_TYPE">
<Value field="value" value="I"/>
</Section>
<Section path="HL7_STANDARD_VERSION">
<Value field="value" value="HL7V3"/>
</Section>
<Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
<Value field="value" value="NE"/>
</Section>
<Section path="SENDING_NETWORK_ADDRESS">
<Value field="value" value=""/>
</Section>
<Section path="SENDING_APPLICATION_IDENTIFIER">
<Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
<Value field="extension" value=""/>
</Section>
<Section path="SENDING_APPLICATION_NAME">
<Value field="value" value="NL HIAL"/>
</Section>
</Section>
</Enricher>
</EnricherParameter>
<EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectCreators:createFindClientsAssociatedIdentifersRequestObject" interactionID="PRPA_IN101105CA">
<Enricher>
<Parameters>
<Parameter name="MESSAGE_ID" reference="test"/>
</Parameters>
<Section path="HEADER">
<Section path="RESPONSE_TYPE">
<Value field="value" value="I"/>
</Section>
<Section path="HL7_STANDARD_VERSION">
<Value field="value" value="HL7V3"/>
</Section>
<Section path="PROCESSING_CODE">
<Value field="value" value="T"/>
</Section>
<!--
<Section path="PROCESSING_MODE_CODE">
<Value field="value" value="T"/>
</Section>
-->
<Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
<Value field="value" value="NE"/>
</Section>
<Section path="RECEIVER_NETWORK_ADDRESS">
<Value field="value" value="prsunew.moh.hnet.bc.ca"/>
</Section>
<Section path="RECEIVER_APPLICATION_IDENTIFIER">
<Value field="root" value="2.16.840.1.113883.3.40.5.1"/>
<Value field="extension" value=""/>
</Section>
<Section path="SENDING_NETWORK_ADDRESS">
<Value field="value" value=""/>
</Section>
<Section path="SENDING_APPLICATION_IDENTIFIER">
<Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
<Value field="extension" value=""/>
</Section>
<Section path="SENDING_APPLICATION_NAME">
<Value field="value" value="NL HIAL"/>
</Section>
</Section>
</Enricher>
</EnricherParameter>
<EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectContentEnrichers:enrichPRRequest" interactionID="">
<!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
<Enricher>
<Parameters>
<Parameter name="MESSAGE_IDENTIFIER" reference="test"/>
</Parameters>
<Section path="HEADER">
<Section path="HL7_STANDARD_VERSION">
<Value field="value" value="V3PR2"/>
</Section>
<!--POS/CPP populated ?-->
<!--Not sure if this should be set as a variance within EHIP or if we expect the POS/CPP to provide this value-->
<Section path="PROCESSING_CODE">
<Value field="value" value="T"/>
</Section>
<!--POS/CPP populated ?-->
<Section path="PROCESSING_MODE_CODE">
<Value field="value" value="T"/>
</Section>
<!--POS/CPP populated ?-->
<Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
<Value field="value" value="NE"/>
</Section>
<!-- note:We Expect PRS to give us a web service address -->
<!--<Section path="RECEIVER_NETWORK_ADDRESS">
<Value field="value" value="_http://PRSServer/svcName"/>
</Section>
-->
<Section path="RECEIVER_APPLICATION_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.3.40.1.14"/>
<Value field="extension" value="SIT1"/>
</Section>
<!-- note: values of the fields to be provided by PRS -->
<Section path="RECEIVER_APPLICATION_NAME[0]">
<Value field="value" value="receiverAppName"/>
</Section>
<!-- note: RECEIVER_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
<!-- note: values of the fields to be specified by PRS later -->
<Section path="RECEIVER_AGENT/RECEIVER_ORGANIZATION/RECEIVER_ORGANIZATION_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.3.40.4.1"/>
<Value field="extension" value="receiverOrgId"/>
</Section>
<Section path="SENDING_APPLICATION_NAME[0]">
<Value field="value" value="NLPRSCLNT"/>
</Section>
<!-- note: SENDING_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
<!-- note: values of the fields to be specified by PRS later -->
<Section path="SENDING_AGENT/SENDING_ORGANIZATION/SENDING_ORGANIZATION_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.4.3.57"/>
<Value field="extension" value="3001"/>
</Section>
<Section path="PERFORMER/HEALTHCARE_WORKER_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.4.3.57"/>
<Value field="extension" value="HIAL_USR"/>
</Section>
</Section>
<Section path="PAYLOAD">
<!--<Section path="QUERY_STATUS_CODE">
<Value field="value" value="New"/>
</Section>-->
<!-- note: AUDIT has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="AUDIT[0]/AUDIT_INFORMATION">
<Value field="code" value="LATEST"/>
<Value field="codeSystem" value="PRSAuditParameters"/>
</Section>
<!-- note: CONFIDENCE has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="CONFIDENCE/CONFIDENCE_VALUE">
<Value field="value" value="100"/>
</Section>
<!-- note: HISTORY has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="HISTORY/INCLUDE_HISTORY_INDICATOR">
<Value field="value" value="false"/>
</Section>
<!-- note: JURISDICTION has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="JURISDICTION/JURISDICTION_TYPE">
<Value field="value" value="NL"/>
</Section>
<!-- note: RESPONSE_OBJECT has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[0]">
<Value field="code" value="GRS_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[1]">
<Value field="code" value="GRS_ELECTRONIC_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[2]">
<Value field="code" value="GRS_IDENTIFIER"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[3]">
<Value field="code" value="GRS_ORGANIZATION_NAME"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[4]">
<Value field="code" value="GRS_PERSONAL_NAME"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[5]">
<Value field="code" value="GRS_REGISTRY_IDENTIFIER"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[6]">
<Value field="code" value="GRS_TELEPHONE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[7]">
<Value field="code" value="PRS_CONDITION"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[8]">
<Value field="code" value="PRS_CONFIDENTIALITY_INDICATOR"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[9]">
<Value field="code" value="PRS_DEMOGRAPHIC_DETAIL"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[10]">
<Value field="code" value="PRS_DISCIPLINARY_ACTION"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[11]">
<Value field="code" value="PRS_INFORMATION_ROUTE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[12]">
<Value field="code" value="PRS_NOTE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[13]">
<Value field="code" value="PRS_PROVIDER_CREDENTIAL"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[14]">
<Value field="code" value="PRS_PROVIDER_EXPERTISE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[15]">
<Value field="code" value="PRS_PROVIDER_RELATIONSHIP"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[16]">
<Value field="code" value="PRS_STATUS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[17]">
<Value field="code" value="PRS_WORK_LOCATION"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[18]">
<Value field="code" value="PRS_WORK_LOCATION_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[19]">
<Value field="code" value="PRS_WORK_LOCATION_DETAIL"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[20]">
<Value field="code" value="PRS_WORK_LOCATION_ELECTRONIC_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[21]">
<Value field="code" value="PRS_WORK_LOCATION_INFORMATION_ROUTE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[22]">
<Value field="code" value="PRS_WORK_LOCATION_TELEPHONE"/>
</Section>
<!-- note: ROLE_CLASS has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="ROLE_CLASS /ROLE_CLASS_VALUE">
<Value field="value" value="LIC"/>
</Section>
<Section path="SORT_CONTROL[0]/SORT_CONTROL_ELEMENT_NAME">
<Value field="code" value="PrincipalPerson.name.value.family"/>
</Section>
<Section path="SORT_CONTROL[0]/SORT_CONTROL_DIRECTION_CODE">
<Value field="value" value="A"/>
</Section>
</Section>
</Enricher>
</EnricherParameter>
</EnricherParametersProfileData>
</ProfileData>
</Profile>
the data is valid against the schema through XML Spy tool... and loaded into the XDB repository...
4) create table and insert data:
SQL> CREATE TABLE EHIP_PROFILE OF SYS.XMLTYPE
2 XMLSCHEMA "http://rac3-1-vip:8080/home/EHIPSBUSER1/xsd/EHIPProfile_v00.xsd" ELEMENT "Profile"
3 ;
Table created.
SQL>
SQL> alter table EHIP_PROFILE
2 add CONSTRAINT EHIP_PROF_PK PRIMARY KEY(XMLDATA."ProfileID"."ID",XMLDATA."ProfileID"."Type");
Table altered.
SQL>
SQL>
SQL>
SQL>
SQL> select xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob() from dual;
XDBURITYPE('/HOME/'||USER||'/PROFILEDATA/ENRICHERPP.ID.0001.XML').GETCLOB()
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy
SQL>
SQL>
SQL> insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()));
insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()))
ERROR at line 1:
ORA-21700: object does not exist or is marked for delete
what's the problem caused the "ORA-21700: object does not exist or is marked for delete" error?
Thanks in advance for your help?Thanks Marco,
Here're my environment:
SQL> select INSTANCE_NUMBER, INSTANCE_NAME,HOST_NAME,VERSION from v$instance;
INSTANCE_NUMBER INSTANCE_NAME HOST_NAME VERSION
2 rac32 RAC3-2 10.2.0.3.0
I followed your suggested in the above, and always purge recyclebin, but still got the same problem. because in 10gr2, there's no dbms_xmlschema.purge_schema available,
and I did checked the recyclebin after force the delete of schema, nothing inside. any other recommendation?
Maybe you are looking for
-
Possibly a dumb question, but here goes: How do I determine the maximum RAM capacity on a Macbook Pro(specs below). I'd like to max out the RAM. Also-is it difficult to add RAM? Thanks.
-
IPhone 5 - black model paint problem
Dear apple community! I have iPhone 5 black model and edge color was chipped off after very carefull usage! If the paint chips this easy now what's my phone gonna look like in a years time after being in and out of my pocket, car keys, kids getting h
-
IPod touch 4th gen is not recognized and will not charge. Tried 3 cords. Help!
We have tried updating, restarting both the iPod and the Mac, 3 cords and 3 different connecting sights (computer, car, and treadmill). Not recognized and not charging.
-
How to call Web Services with Sun Java Studio Creator?
Can someone from Sun please explain how to use the sample Web Services USWeather and GoogleSearch in Sun Java Studio Creator (no Portlet Application)? I read the Web Service Tutorial Accessing Web Services (http://developers.sun.com/prodtech/javatool
-
IDOC order of columns not same as the data source
Hi, I am from non SAP background. We are using Informatica to pull data from SAP ECC using the Business Content for Integration by pulling data from IDOCS. Here is my problem: 1) We identified a particular data source (0FI_GL_4) for full mode data pu