XMLTYPE View
Hello
How can I insert into XMLTYPE View ?
Thanks for any help...
Hello
How can I insert into XMLTYPE View ?
Thanks for any help...
Similar Messages
-
I have created an XMLType view with an INSTEAD OF trigger to insert data into the underlying tables. I used your example on XMLType view of Relational Content
It works great if I have no attributes defined in the root element of the XML document (i.e. xmlns, schemaLocation, etc.). However, if my document contains any of those attributes, it will not load. I have tried creating the view with and without the xml attributes, as well as making sure that the schemaLocation is identical to the one in the document (copied and pasted just to make sure).
Is there anything that you can point to right away that I'm missing?
If needed, I can post code for you.
Thanks!Here is the code I used to generate the tables, view, and triggers:
drop table p_student_demographics;
create table p_student_demographics -- a
wiser_id varchar2(8),
first_name varchar2(15),
middle_name varchar2(15),
last_name varchar2(25),
birthdate date,
school_id varchar2(7),
special_ed_teacher varchar2(50)
drop table p_scorer_info;
create table p_scorer_info -- b
test_record_id number,
scorer_number number,
name varchar2(80),
email varchar2(50)
drop table p_test_record;
create table p_test_record -- c
wiser_id varchar2(8),
test_record_id number,
grade_tested varchar2(2),
first_scorer_completed varchar2(3),
second_scorer_completed varchar2(3)
drop table p_psw_test_results;
create table p_psw_test_results -- d
test_record_id number,
subject varchar2(7),
entry_number number,
complexity varchar2(1),
performance varchar2(1),
independence varchar2(1),
generalization varchar2(1),
non_scorable varchar2(4)
drop table p_spe_test_results;
create table p_spe_test_results -- e
test_record_id number,
subject varchar2(7),
entry_number number,
item_number number,
response varchar2(1)
drop table p_total_scores;
create table p_total_scores -- f
test_record_id number,
subject varchar2(7),
psw_total_raw_score varchar2(2),
spe_total_raw_score varchar2(2),
tas_score varchar2(2),
tas_portfolio_score varchar2(2),
tas_spe_score varchar2(2),
overall_total_raw_score varchar2(2),
overall_performance_level varchar2(1)
drop table p_school_info;
create table p_school_info
district_id varchar2(7),
district_name varchar2(80),
school_id varchar2(7),
school_name varchar2(80)
create or replace view paws_alt_test_results
of xmltype
xmlschema "http://www.k12.wy.us/public/paws-alt-results-v1.xsd" element "PawsAltResults"
with object id
(to_number(extractValue(object_value,'/PawsAltResults/Students/TestRecord/TestRecordId')))
as
select xmlelement
"PawsAltResults",
xmlelement
"Students",
xmlelement
"StudentInfo",
xmlelement
"StudentDemographics",
xmlelement("WiserId", a.wiser_id),
xmlelement("FirstName", a.first_name),
xmlelement("MiddleName", a.middle_name),
xmlelement("LastName", a.last_name),
xmlelement("BirthDate", a.birthdate)
xmlelement("SchoolId", a.school_id),
xmlelement("SpecialEdTeacher", a.special_ed_teacher),
xmlelement
"DocumentCompletedBy",
xmlelement("FirstScorer", c.first_scorer_completed),
xmlelement("SecondScorer", c.second_scorer_completed)
xmlelement
"FirstScorerInfo",
xmlelement("Name", b1.name),
xmlelement("Email", b1.email)
xmlelement
"SecondScorerInfo",
xmlelement("Name", b2.name),
xmlelement("Email", b2.email)
xmlelement
"TestRecord",
xmlelement("TestRecordId", c.test_record_id),
xmlelement("GradeTested", c.grade_tested),
xmlelement
"Subjects",
select xmlagg
xmlelement
"Subject",
xmlelement("SubjectName", f.subject),
xmlelement
"Psw",
xmlelement
"Entries",
select xmlagg
xmlelement
"Entry",
xmlelement("EntryNumber", x.entry_number),
xmlelement("Complexity", x.complexity),
xmlelement("Performance", x.performance),
xmlelement("Independence", x.independence),
xmlelement("Generalization", x.generalization),
xmlelement("NonScorable", x.non_scorable)
from p_psw_test_results x
where f.test_record_id = x.test_record_id
and f.subject = x.subject
xmlelement("TotalRawScore", f.psw_total_raw_score)
xmlelement
"Spe",
xmlelement
"Entries",
select xmlagg
xmlelement
"Entry",
xmlelement("EntryNumber", x.entry_number),
xmlelement
"Items",
select xmlagg
xmlelement
"Item",
xmlelement("ItemNumber", y.item_number),
xmlelement("Response", y.response)
from p_spe_test_results y
where x.test_record_id = y.test_record_id
and x.subject = y.subject
and x.entry_number = y.entry_number
from (select distinct
test_record_id,
subject,
entry_number
from p_spe_test_results) x
where f.test_record_id = x.test_record_id
and f.subject = x.subject
xmlelement("TotalRawScore", f.spe_total_raw_score)
xmlelement("TasScore", f.tas_score),
xmlelement("TasPortfolioScore", f.tas_portfolio_score),
xmlelement("TasSpeScore", f.tas_spe_score),
xmlelement("OverallTotalRawScore", f.overall_total_raw_score),
xmlelement("OverallPerformanceLevel", f.overall_performance_level)
from p_total_scores f
where c.test_record_id = f.test_record_id
xmlelement
"Districts",
select xmlagg
xmlelement
"DistrictInfo",
xmlelement("DistrictId", district_id),
xmlelement("DistrictName", district_name)
from (select distinct
district_id,
district_name
from p_school_info)
xmlelement
"Schools",
select xmlagg
xmlelement
"SchoolInfo",
xmlelement("DistrictId", district_id),
xmlelement("SchoolId", school_id),
xmlelement("SchoolName", school_name)
from p_school_info
from p_student_demographics a,
p_scorer_info b1,
p_scorer_info b2,
p_test_record c
where a.wiser_id = c.wiser_id
and b1.test_record_id = b2.test_record_id
and b1.test_record_id = c.test_record_id
and b1.scorer_number = 1
and b2.scorer_number = 2;
create or replace trigger io_ins_paws_alt_results
instead of insert on paws_alt_test_results
begin
insert all
into p_student_demographics
(wiser_id, first_name, middle_name, last_name, birthdate, school_id,
special_ed_teacher)
values
(wiser_id, first_name, middle_name, last_name, birthdate, school_id,
special_ed_teacher)
into p_scorer_info
(test_record_id, scorer_number, name, email)
values
(test_record_id, 1, name1, email1)
into p_scorer_info
(test_record_id, scorer_number, name, email)
values
(test_record_id, 2, name2, email2)
into p_test_record
(wiser_id, test_record_id, grade_tested, first_scorer_completed,
second_scorer_completed)
values
(wiser_id, test_record_id, grade_tested, first_scorer_completed,
second_scorer_completed)
select a.*
from xmltable
'/PawsAltResults'
passing :new.object_value
columns
wiser_id varchar2(8) path 'Students/StudentInfo/StudentDemographics/WiserId',
first_name varchar2(15) path 'Students/StudentInfo/StudentDemographics/FirstName',
middle_name varchar2(15) path 'Students/StudentInfo/StudentDemographics/MiddleName',
last_name varchar2(25) path 'Students/StudentInfo/StudentDemographics/LastName',
birthdate date path 'Students/StudentInfo/StudentDemographics/Birthdate',
school_id varchar2(7) path 'Students/StudentInfo/SchoolId',
special_ed_teacher varchar2(50) path 'Students/StudentInfo/SpecialEdTeacher',
test_record_id number path 'Students/StudentInfo/TestRecord/TestRecordId',
name1 varchar2(80) path 'Students/StudentInfo/FirstScorerInfo/Name',
email1 varchar2(50) path 'Students/StudentInfo/FirstScorerInfo/Email',
name2 varchar2(80) path 'Students/StudentInfo/SecondScorerInfo/Name',
email2 varchar2(50) path 'Students/StudentInfo/SecondScorerInfo/Email',
grade_tested varchar2(2) path 'Students/StudentInfo/TestRecord/GradeTested',
first_scorer_completed varchar2(3) path 'Students/StudentInfo/DocumentCompletedBy/FirstScorer',
second_scorer_completed varchar2(3) path 'Students/StudentInfo/DocumentCompletedBy/SecondScorer'
) a;
insert all
into p_psw_test_results
(test_record_id, subject, entry_number, complexity, performance,
independence, generalization, non_scorable)
values
(test_record_id, subject, entry_number, complexity, performance,
independence, generalization, non_scorable)
into p_total_scores
(test_record_id, subject, psw_total_raw_score, spe_total_raw_score,
tas_score, tas_portfolio_score, tas_spe_score,
overall_total_raw_score, overall_performance_level)
values
(test_record_id, subject, psw_total_raw_score, spe_total_raw_score,
tas_score, tas_portfolio_score, tas_spe_score,
overall_total_raw_score, overall_performance_level)
select a.test_record_id,
b.subject,
b.psw_total_raw_score,
b.spe_total_raw_score,
b.tas_score,
b.tas_portfolio_score,
b.tas_spe_score,
b.overall_total_raw_score,
b.overall_performance_level,
c.*
from xmltable
'/PawsAltResults/Students/StudentInfo/TestRecord'
passing :new.object_value
columns
test_record_id number path 'TestRecordId',
subjects xmltype path 'Subjects/Subject'
) a,
xmltable
'/Subject'
passing a.subjects
columns
subject varchar2(7) path 'SubjectName',
psw_total_raw_score varchar2(2) path 'Psw/Entries/TotalRawScore',
spe_total_raw_score varchar2(2) path 'Spe/TotalRawScore',
tas_score varchar2(2) path 'TasScore',
tas_portfolio_score varchar2(2) path 'TasPortfolioScore',
tas_spe_score varchar2(2) path 'TasSpeScore',
overall_total_raw_score varchar2(2) path 'OverallTotalRawScore',
overall_performance_level varchar2(1) path 'OverallPerformanceLevel',
entries xmltype path 'Psw/Entries/Entry'
) b,
xmltable
'/Entry'
passing b.entries
columns
entry_number number path 'EntryNumber',
complexity varchar2(1) path 'Complexity',
performance varchar2(1) path 'Performance',
independence varchar2(1) path 'Independence',
generalization varchar2(1) path 'Generalization',
non_scorable varchar2(4) path 'NonScorable'
) c;
insert
into p_spe_test_results
(test_record_id, subject, entry_number, item_number, response)
select a.test_record_id,
b.subject,
c.entry_number,
d.*
from xmltable
'/PawsAltResults/Students/StudentInfo/TestRecord'
passing :new.object_value
columns
test_record_id number path 'TestRecordId',
subjects xmltype path 'Subjects/Subject'
) a,
xmltable
'/Subject'
passing a.subjects
columns
subject varchar2(7) path 'SubjectName',
entries xmltype path 'Spe/Entries/Entry'
) b,
xmltable
'/Entry'
passing b.entries
columns
entry_number number path 'EntryNumber',
items xmltype path 'Items/Item'
) c,
xmltable
'/Item'
passing c.items
columns
item_number number path 'ItemNumber',
response varchar2(1) path 'Response'
) d;
insert
into p_school_info
(district_id, district_name, school_id, school_name)
select a.district_id,
a.district_name,
b.school_id,
b.school_name
from xmltable
'PawsAltResults/Districts/DistrictInfo'
passing :new.object_value
columns
district_id varchar2(7) path 'DistrictId',
district_name varchar2(80) path 'DistrictName'
) a,
xmltable
'PawsAltResults/Schools/SchoolInfo'
passing :new.object_value
columns
district_id varchar2(7) path 'DistrictId',
school_id varchar2(7) path 'SchoolId',
school_name varchar2(80) path 'SchoolName'
) b
where a.district_id = b.district_id;
end io_ins_paws_alt_results;
XML document:
<?xml version="1.0" encoding="UTF-8"?>
<PawsAltResults xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/XMLSchema http://www.k12.wy.us/public/paws-alt-results-v1.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
<Students>
<StudentInfo>
<StudentDemographics>
<WiserId>12345678</WiserId>
<FirstName>TestFirst</FirstName>
<MiddleName>M</MiddleName>
<LastName>TestLast</LastName>
<BirthDate>2000-02-02</BirthDate>
</StudentDemographics>
<SchoolId>2222222</SchoolId>
<SpecialEdTeacher>Test Special Ed Teacher</SpecialEdTeacher>
<DocumentCompletedBy>
<FirstScorer>Yes</FirstScorer>
<SecondScorer>No</SecondScorer>
</DocumentCompletedBy>
<FirstScorerInfo>
<Name>Test First Scorer</Name>
<Email>[email protected]</Email>
</FirstScorerInfo>
<SecondScorerInfo>
<Name>Test Second Scorer</Name>
<Email>[email protected]</Email>
</SecondScorerInfo>
<TestRecord>
<TestRecordId>1</TestRecordId>
<GradeTested>08</GradeTested>
<Subjects>
<Subject>
<SubjectName>Reading</SubjectName>
<Psw>
<Entries>
<Entry>
<EntryNumber>1</EntryNumber>
<Complexity>1</Complexity>
<Performance>2</Performance>
<Independence>3</Independence>
<Generalization>B</Generalization>
</Entry>
</Entries>
<TotalRawScore>20</TotalRawScore>
</Psw>
<Spe>
<Entries>
<Entry>
<EntryNumber>1</EntryNumber>
<Items>
<Item>
<ItemNumber>1</ItemNumber>
<Response>1</Response>
</Item>
<Item>
<ItemNumber>2</ItemNumber>
<Response>2</Response>
</Item>
</Items>
</Entry>
</Entries>
<TotalRawScore>30</TotalRawScore>
</Spe>
<TasScore>10</TasScore>
<TasPortfolioScore>20</TasPortfolioScore>
<TasSpeScore>15</TasSpeScore>
<OverallTotalRawScore>50</OverallTotalRawScore>
<OverallPerformanceLevel>3</OverallPerformanceLevel>
</Subject>
</Subjects>
</TestRecord>
</StudentInfo>
</Students>
<Districts>
<DistrictInfo>
<DistrictId>1111111</DistrictId>
<DistrictName>Test District Name</DistrictName>
</DistrictInfo>
</Districts>
<Schools>
<SchoolInfo>
<DistrictId>1111111</DistrictId>
<SchoolId>2222222</SchoolId>
<SchoolName>Test School Name</SchoolName>
</SchoolInfo>
</Schools>
</PawsAltResults>
Insert statement:
insert into paws_alt_test_results values (xmltype(bfilename('XMLDIR','test-paws-alt.xml'),nls_charset_id('AL32UTF8')));
There are no errors shown on the insert statement. It tells me that one row was inserted, but there is no data when looking at the tables (unless I remove the attributes from the root element of the XML file).
I'm using version 10.2.0.3
Thanks for your help! -
Extracting xml content in a XMLTYPE VIEW
Experts:
I need to create an xmltype view based on the following xml content.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<EMPLOYEES CREATED="2013-02-06T12:33:00" xsi:noNamespaceSchemaLocation="http://supporthtml.oracle.com/TEST_SCHEMA.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<EMPLOYEE_TRANS MODE="A" emp_id="1">
<emp_nm>SCOTT</emp_nm>
<emp_dept>FN</emp_dept>
<mgr>DON</mgr>
<sal>4000</sal>
<updt_ts>2013-02-06T12:28:00</updt_ts>
</EMPLOYEE_TRANS>
<EMPLOYEE_TRANS MODE="A" emp_id="2">
<emp_nm>KEVIN</emp_nm>
<emp_dept>HR</emp_dept>
<mgr>MIKE</mgr>
<sal>3000</sal>
<updt_ts>2013-02-06T12:29:00</updt_ts>
</EMPLOYEE_TRANS>
</EMPLOYEES>I want to run a select statement againt this view which can give me column data in this format.
This xml is already stored in an Oracle XMLTYPE Object Relation table which conforms to a registered xsd schema document.
select CREATED, MODE, EMP_ID, emp_nm, emp_dept, mgr, sal, updt_ts from employees_view.
Result:
2013-02-06T12:33:00 A 1 SCOTT FN DON 4000 2013-02-06T12:28:00
2013-02-06T12:33:00 A 2 KEVIN HR MIKE 3000 2013-02-06T12:29:00How can I achieve this? I tried by getting various errors. I would appreciate if someone can send me a sample
11.2.0.3
Linux
XMLDBThanks
Kevin
Edited by: Kevin_K on Feb 6, 2013 9:54 AM
Edited by: Kevin_K on Feb 6, 2013 9:55 AMI guess the above makes a regular relational view? correct?Yes.
How can I extract the of CREATED attribute from the top most employees element and attributes "MODE" and "emp_id" from EMPLOYEE_TRANS element ? You have to use a two-level approach :
SQL> select x1.created, x2.*
2 from EMPLOYEES_OR_TABLE t
3 , xmltable('/EMPLOYEES'
4 passing t.object_value
5 columns created timestamp path '@CREATED'
6 , emps xmltype path 'EMPLOYEE_TRANS'
7 ) x1
8 , xmltable('/EMPLOYEE_TRANS'
9 passing x1.emps
10 columns emp_mode varchar2(1) path '@MODE'
11 , emp_id number path '@emp_id'
12 , emp_nm varchar2(30) path 'emp_nm'
13 , updt_ts timestamp path 'updt_ts'
14 ) x2 ;
CREATED EMP_MODE EMP_ID EMP_NM UPDT_TS
06/02/13 12:33:00,000000 A 1 SCOTT 06/02/13 12:28:00,000000
06/02/13 12:33:00,000000 A 2 KEVIN 06/02/13 12:29:00,000000
The first XMLTable x1 extracts top-level information, then passes the collection of EMPLOYEE_TRANS elements to a second XMLTable that breaks each item in separate rows and columns.
It's also possible to use a single XMLTable, but with a little more complex XQuery expression. -
Hallo,
Can anyone explain me the purpose of the "with object id"-clause in an xmltype view in detail? According to the documentation the oid should uniquely identify each row in the view. But there is no error message if I choose an elements that occurs in multiple rows of the view. It is possible to choose an unavailable path to an ele-ment without any error messages, too ....
Is it possible to choose a String as the OID too? I always get an "ORA-22973: size of object identifier exceeds maximum size allowed".
thanxs,
Vanessaobject-id should provide a unqiue identifier. It's needed if you want to generate a ref() to the rows in the view (for instance if you want to folder the rows as documents in the xml db repository). It can also be used during query optimization
-
FTPing into XMLType view (ORA-21700)
Hi all,
I have some relational data, which I want to display as XML. To get there I successfully created and registered a XML schema and created a XMLType view. So far so good ... I see all data as XML in this view.
Now I'd like to FTP new XML documents, which are based on this XML schema, into previously created folders. So I wrote an INSTEAD OF trigger to insert the data in my relational tables. When I do a ftp put ..., all I get is ORA-21700 object does not exist or is marked for delete.
Any tips or hints to resolve this problem ?
Any help is appreciated...
Regards MarkusHi all,
I found out, that SQL inserts are working... So, why does ftp-ing not work ?
Regards Markus -
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.
-
XMLType Views . Automatic creation XMLSchema?
http://otn.oracle.com/oramag/webcolumns/2003/techarticles/scardina_xmldb.html
In this clause there is such offer:
«Functions are provided in the database and XDK to create XML schemas automatically from XMLType Views»
Give please the reference in the documentation as it to make with help PL/SQL.
All good, Rustem.No, to me interestingly automatically to generate text XMLschema on basis XMLType, received by SQLX functions...
-
Error when a try to update a xmltype view thru a trigger instead of update
<PERSON>
<ID>4</ID>
<FIRSTNAME>Frédéric</FIRSTNAME>
<LASTNAME>Philippekin</LASTNAME>
<SEX>M</SEX>
<WEIGHT>75</WEIGHT>
<HEIGHT>175</HEIGHT>
</PERSON>
CREATE OR REPLACE VIEW personne_oracle OF XMLType
XMLSCHEMA "personOracle.xsd" ELEMENT "PERSON"
WITH OBJECT ID (EXTRACT(sys_nc_rowinfo$, '/PERSON/ID').getNumberVal())
AS SELECT XMLELEMENT("PERSON",
XMLFOREST( Id,
FirstName,
LastName,
Sex,
Weight,
Height)
) AS Valeur
FROM Person;
CREATE OR REPLACE TRIGGER u_personne_oracle_tr
INSTEAD OF UPDATE on personne_oracle
BEGIN
UPDATE Person SET
Person.FirstName = extractvalue(:new.sys_nc_rowinfo$,'/PERSON/FIRSTNAME/text()'),
Person.LastName = extractvalue(:new.sys_nc_rowinfo$,'/PERSON/LASTNAME/text()'),
Person.Weight = extractvalue(:new.sys_nc_rowinfo$,'/PERSON/WEIGHT/text()'),
Person.Height = extractvalue(:new.sys_nc_rowinfo$,'/PERSON/HEIGHT/text()')
WHERE Person.Id = extractvalue(:new.sys_nc_rowinfo$,'/PERSON/ID');
END;
UPDATE personne_oracle x
SET value(x) = updateXML(value(x), '/PERSON/FIRSTNAME/text()','Fred')
WHERE extractValue(value(x), '/PERSON/ID') = 4;
ORA-24358: OCIBindObject not invoked for a Object type or Reference
please help me !What happens if you move the view to the remote db?
and create a synonym for the view on the local?it doesn't work !
>
alternatively,
what happens if you modify from person@oraclelink in
the create or replace view personne_oracle?it doesn't work !
The problem is the dblink ! Without it it's work !
thx for your answer. -
Hi,
is it possible to use a xml view in BIP?
suppose i have the following view:
CREATE OR REPLACE VIEW DEPT_EMP_XML
OF SYS.XMLTYPE
WITH OBJECT IDENTIFIER (extract(object_value, '/departments/department/@id').getnumberval())
AS
select sys_xmlagg (xmlelement ("department"
, xmlattributes (department_id as "id")
, xmlagg (xmlelement ("employee"
, xmlforest (last_name as "last_name"
, first_name as "first_name"
, email as "email"
, xmlformat ('departments')
) xml
from (select d.department_id
, d.department_name
, e.last_name
, e.first_name
, e.email
from departments d, employees e
where d.department_id = e.department_id)
group by department_id
order by department_id
when i make a query in BIP like
select DEPT_EMP_XML.SYS_NC_ROWINFO$ as emp
from HR.DEPT_EMP_XML DEPT_EMP_XML
then i get only this
<?xml version="1.0" encoding="UTF-8" ?>
- <ROWSET>
- <ROW>
<EMP />
</ROW>
</ROWSET>
is there a way to use this kind of views in BIP?
thxHi Arnaud
You just need to make a small addition to hte query:
select DEPT_EMP_XML.SYS_NC_ROWINFO$.getClobVal() as emp
Regards
Tim -
Writing large xmltype data to UTL_FILE and setting max row per file
Hey Gurus,
I am trying to create a procedure (in Oracle 9i) that writes out xml data I have created into several xml files (file would probably be to large for one xml file output...I am doing this for 270,000 rows of data), setting the max rows to 1000 rows per file. I know one would have to create a looping contsruct to do this but I am just not adept enough in PL/SQL to figure it out at the moment.
So essentially their would be some sort of loop construct and substr process that creates a file after looping through 1000 rows and then continues the count and creates a another file until all 270 xml files are created. Simple enough right...lol? Well I've tried doing this and haven't gotten anywhere. My pl/sql coding skills are too elementary I am guessing. I've only been doing this for about three months and could use the assistance of a more experienced person here.
Here are the particulars...
This is the xmltype view code that I used to create the xml data.
select XMLELEMENT("macess_exp_import_export_file",
XMLELEMENT("file_header",
XMLELEMENT("file_information")),
XMLELEMENT("items",
XMLELEMENT("documents",
(SELECT XMLAGG(XMLELEMENT("document",
XMLELEMENT("external_reference"),
XMLELEMENT("processing_instructions",
XMLELEMENT("update", name)),
XMLELEMENT("filing_instructions",
XMLELEMENT("folder_ids",
XMLELEMENT("folder",
XMLATTRIBUTES(folder_id AS "id", folder_type_id AS "folder_type_id")))),
XMLELEMENT("document_header",
XMLELEMENT("document_type",
XMLATTRIBUTES(document_type AS "id")),
XMLELEMENT("document_id", document_id),
XMLELEMENT("document_description", document_description),
XMLELEMENT("document_date",
XMLATTRIBUTES(name AS "name"), document_date),
XMLELEMENT("document_properties")),
XMLELEMENT("document_data",
XMLELEMENT("internal_file",
XMLELEMENT("document_file_path", document_file_path),
XMLELEMENT("document_extension", document_extension)
))))from macess_import_base WHERE rownum < 270000))))AS result
from macess_import_base WHERE rownum < 270000;
This is the Macess_Import_Base table that I am creating xml data from
create table MACESS_IMPORT_BASE
MACESS_EXP_IMPORT_EXPORT_FILE VARCHAR2(100),
FILE_HEADER VARCHAR2(20),
ITEMS VARCHAR2(20),
DOCUMENTS VARCHAR2(20),
DOCUMENT VARCHAR2(20),
EXTERNAL_REFERENCE VARCHAR2(20),
PROCESSING_INSTRUCTIONS VARCHAR2(20),
PATENT VARCHAR2(20),
FILING_INSTRUCTIONS VARCHAR2(20),
FOLDER_IDS VARCHAR2(20),
FOLDER_ID VARCHAR2(20),
FOLDER_TYPE_ID NUMBER(20),
DOCUMENT_HEADER VARCHAR2(20),
DOCUMENT_PROPERTIES VARCHAR2(20),
DOCUMENT_DATA VARCHAR2(20),
INTERNAL_FILE VARCHAR2(20),
NAME VARCHAR2(20),
DOCUMENT_TYPE VARCHAR2(40),
DOCUMENT_ID VARCHAR2(64),
DOCUMENT_DESCRIPTION VARCHAR2(200),
DOCUMENT_DATE VARCHAR2(100),
DOCUMENT_FILE_PATH VARCHAR2(200),
DOCUMENT_EXTENSION VARCHAR2(200)
Directory name to write output to "DIR_PATH"
DIRECTORY PATH is "\app\cdg\cov"
Regards,
ChrisI also would like to use UTL_FILE to achieve this functionality in the procedure.
-
MakeProcessingInstruction PL/SQL DOM API for XMLType
Does anyone have a code snippet on how to use makeProcessingInstruction()(PL/SQL DOM API for XMLType)
Description
Casts a given DOMNode to a DOMProcessingInstruction, and returns the
DOMProcessingInstruction.
Syntax
FUNCTION makeProcessingInstruction( n DOMNode)
RETURN DOMProcessingInstruction;
Thanks in advancepieter,
I think you would want to use xmlview. A schema can be attached to the view definition, thereby creating a schema-based xmltype view.
ie create view nameview of xmltype
xmlschema "nameschema.xsd" ELEMENT "namehere"
as
select
xmlelement ("....xmlforest(....(select xmlagg(xmlelement(....
or something similar.
see link for more information regarding xml views.
http://www.vldb.org/conf/2003/papers/S30P02.pdf -
How to force simple tags and null attributes to appear when using SQL/XML?
Hello everybody:
I'm developing a non-schema based XMLType view.
When the XML document is generated, i noticed two things I need to manage in order to achieve the desired result:
1. Oracle generates a <tag></tag> pair for each XMLELEMENT defined; in my case, some tags need to appear as <tag/>... how do I do? Is it possible when using schema based XMLType views? Is it possible while using a non-schema approach?
2. When using XMLATTRIBUTE('' AS "attribute") or XMLATTRIBUTE(NULL AS "attribute"), no one attribute with label "attribute" and null value appears at the output; how do I force to Oracle DB to render those attributes which are with no values (needed to render those attributes as another parsing code will await for all the items)?
3. Some tip about how to route the output to an XML text disk file will be appreciated.
Thanks in advance.
Edited by: Enyix on 26/02/2012 11:21 PM
Edited by: Enyix on 26/02/2012 11:22 PMHello odie_63, thanks for your reply:
Reasons why needed single tags are these two next: Needed to generate a single XML file from 50,000,000 rows, where the XML ouput matches not only row data but another default values for another elements and attributes (not from database but using strings and types with default values); by using start and end tag, the generated file is as much twice bigger than using single tags; second, needed a very precise presentation for all the document.
For generating that document, currently focus is based on using a batch process relying on Spring Batch with using a single JDBC query where a join happens between two tables. From my point of view, that approach uses: database resources, network resources, disk resources, and processing resources, including the price of making the join, sending to network, creating objects, validating, and making the file (Expending too much time generating that XML file). That processs currently is in development.
I think possibly another approach is delegating the complete generation of that file to the database using its XML capabilities. My current approach following your recomendations is to generate a clob where I will put all the XML and putting it into a table. It leads me to another issues: Considering limitations on memory, processing and disk space, needed to append a single row-as-xml into the clob as soon as possible, and putting the clob inside the field as soon as possible, or putting the clob inside the field, and appending into it as the data is generated; so How do I manage the process in order to achieve that goals?. Seen these issues aren't related to my original question, so I'll open a new post. Any help will be apreciated.
Thanks again in advance. -
Performance Issues with large XML (1-1.5MB) files
Hi,
I'm using an XML Schema based Object relational storage for my XML documents which are typically 1-1.5 MB in size and having serious performance issues with XPath Query.
When I do XPath query against an element of SQLType varchar2, I get a good performance. But when I do a similar XPath query against an element of SQLType Collection (Varray of varchar2), I get a very ordinary performance.
I have also created indexes on extract() and analyzed my XMLType table and indexes, but I have no performance gain. Also, I have tried all sorts of storage options available for Collections ie. Varray's, Nested Tables, IOT's, LOB's, Inline, etc... and all these gave me same bad performance.
I even tried creating XMLType views based on XPath queries but the performance didn't improve much.
I guess I'm running out of options and patience as well.;)
I would appreciate any ideas/suggestions, please help.....
Thanks;
Ramakrishna ChintaAre you having similar symptoms as I am? http://discussions.apple.com/thread.jspa?threadID=2234792&tstart=0
-
How to add image in virtual dir / i/ 11g when using the embedded gateway
Hi,
Does somebody knows how to 'simple' import a file or directory
into the /images/ or /i/ directory created by APEX without tricks like in How I added a new image to APEX in 11g when using the embedded gateway.
when using Database 11g with the embedded gateway. with webdav of ftp.
When I use the url http://localhost/images
I need to logon.
There is not 1 username/password that I can use. I tried all.
When I try http://localhost/i/16admin.gif then the gif is shown.
I must be something with ACL's or DBMS_EPG or maybe the default port 80 that I use?
My configuration is
Doing 11.1.0.6.0 checks
############# Status/Version #############
XDB Status is: VALID at version 11.1.0.6.0
############# OTHER DATABASE FEATURES #############
Oracle Application Express is VALID at version 3.1.2.00.02
OWB is VALID at version 11.1.0.6.0
Oracle Enterprise Manager is VALID at version 11.1.0.6.0
Oracle Ultra Search is VALID at version 11.1.0.6.0
OLAP Catalog is VALID at version 11.1.0.6.0
Spatial is VALID at version 11.1.0.6.0
Oracle Multimedia is VALID at version 11.1.0.6.0
Oracle XML Database is VALID at version 11.1.0.6.0
Oracle Text is VALID at version 11.1.0.6.0
Oracle Expression Filter is VALID at version 11.1.0.6.0
Oracle Rules Manager is VALID at version 11.1.0.6.0
Oracle Workspace Manager is VALID at version 11.1.0.6.0
Oracle Database Catalog Views is VALID at version 11.1.0.6.0
Oracle Database Packages and Types is VALID at version 11.1.0.6.0
JServer JAVA Virtual Machine is VALID at version 11.1.0.6.0
Oracle XDK is VALID at version 11.1.0.6.0
Oracle Database Java Packages is VALID at version 11.1.0.6.0
OLAP Analytic Workspace is VALID at version 11.1.0.6.0
Oracle OLAP API is VALID at version 11.1.0.6.0
############# XDBCONFIG INFORMATION #############
acl-max-age= = = 15
acl-cache-size= = = 32
case-sensitive= = = true
call-timeout= = = 6000
max-link-queue= = = 65536
max-session-use= = = 100
persistent-sessions= = = false
default-lock-timeout= = = 3600
xdbcore-logfile-path= = = /sys/log/xdblog.xml
xdbcore-log-level= = = 0
resource-view-cache-size= = = 1048576
extension= = = au
mime-type= = = audio/basic
extension= = = avi
mime-type= = = video/x-msvideo
extension= = = bin
mime-type= = = application/octet-stream
extension= = = bmp
mime-type= = = image/bmp
extension= = = css
mime-type= = = text/css
extension= = = doc
mime-type= = = application/msword
extension= = = eml
mime-type= = = message/rfc822
extension= = = gif
mime-type= = = image/gif
extension= = = htm
mime-type= = = text/html
extension= = = html
mime-type= = = text/html
extension= = = jpe
mime-type= = = image/jpeg
extension= = = jpeg
mime-type= = = image/jpeg
extension= = = jpg
mime-type= = = image/jpeg
extension= = = js
mime-type= = = application/x-javascript
extension= = = jsp
mime-type= = = text/html
extension= = = mid
mime-type= = = audio/mid
extension= = = mov
mime-type= = = video/quicktime
extension= = = movie
mime-type= = = video/x-sgi-movie
extension= = = mp3
mime-type= = = audio/mpeg
extension= = = mpe
mime-type= = = video/mpg
extension= = = mpeg
mime-type= = = video/mpg
extension= = = mpg
mime-type= = = video/mpg
extension= = = msa
mime-type= = = application/x-msaccess
extension= = = msw
mime-type= = = application/x-msworks-wp
extension= = = pcx
mime-type= = = application/x-pc-paintbrush
extension= = = pdf
mime-type= = = application/pdf
extension= = = png
mime-type= = = image/png
extension= = = ppt
mime-type= = = application/vnd.ms-powerpoint
extension= = = ps
mime-type= = = application/postscript
extension= = = qt
mime-type= = = video/quicktime
extension= = = ra
mime-type= = = audio/x-realaudio
extension= = = ram
mime-type= = = audio/x-realaudio
extension= = = rm
mime-type= = = audio/x-realaudio
extension= = = rtf
mime-type= = = application/rtf
extension= = = rv
mime-type= = = video/x-realvideo
extension= = = sgml
mime-type= = = text/sgml
extension= = = svg
mime-type= = = image/svg+xml
extension= = = tif
mime-type= = = image/tiff
extension= = = tiff
mime-type= = = image/tiff
extension= = = txt
mime-type= = = text/plain
extension= = = url
mime-type= = = text/plain
extension= = = vrml
mime-type= = = x-world/x-vrml
extension= = = wav
mime-type= = = audio/wav
extension= = = wpd
mime-type= = = application/wordperfect5.1
extension= = = xls
mime-type= = = application/vnd.ms-excel
extension= = = xml
mime-type= = = text/xml
extension= = = xsd
mime-type= = = text/xml
extension= = = xsl
mime-type= = = text/xml
extension= = = zip
mime-type= = = application/x-zip-compressed
extension= = = htc
mime-type= = = text/x-component
extension= = = xbl
mime-type= = = text/xml
extension= = = en
lang= = = english
extension= = = gzip
encoding= = = zip file
extension= = = tar
encoding= = = tar file
session-pool-size= = = 50
session-timeout= = = 6000
ftp-port= = = 0
ftp-listener= = = local_listener
ftp-protocol= = = tcp
logfile-path= = = /sys/log/ftplog.xml
log-level= = = 0
session-timeout= = = 6000
buffer-size= = = 8192
http-port= = = 80
http-listener= = = local_listener
http-protocol= = = tcp
max-http-headers= = = 64
max-header-size= = = 16384
max-request-body= = = 2000000000
session-timeout= = = 6000
server-name= = = XDB HTTP Server
logfile-path= = = /sys/log/httplog.xml
log-level= = = 0
servlet-realm= = = Basic realm="XDB"
welcome-file= = = index.html
welcome-file= = = index.htm
servlet-pattern= = = /Test
servlet-name= = = TestServlet
servlet-pattern= = = /oradb/*
servlet-name= = = DBURIServlet
servlet-pattern= = = /orarep/*
servlet-name= = = ReportFmwkServlet
servlet-pattern= = = /i/*
servlet-name= = = PublishedContentServlet
servlet-pattern= = = /apex/*
servlet-name= = = APEX
servlet-pattern= = = /images/*
servlet-name= = = IMAGES
servlet-name= = = TestServlet
servlet-language= = = Java
display-name= = = XDB Test Servlet
description= = = A servlet to test the internals of the XDB Servlet API
servlet-class= = = xdbtserv
servlet-schema= = = xdb
servlet-name= = = DBURIServlet
servlet-language= = = C
display-name= = = DBURI
description= = = Servlet for accessing DBURIs
role-name= = = authenticatedUser
role-link= = = authenticatedUser
servlet-name= = = ReportFmwkServlet
servlet-language= = = C
display-name= = = REPT
description= = = Servlet for accessing reports
role-name= = = authenticatedUser
role-link= = = authenticatedUser
servlet-name= = = PublishedContentServlet
servlet-language= = = C
display-name= = = Unauthenticated File Access Servlet
description= = = Servlet for files for unauthenticated users
param-name= = = RootFolder
param-value= = = /images
description= = = RootFolder
role-name= = = anonymousServletRole
role-link= = = anonymousServletRole
servlet-name= = = APEX
servlet-language= = = PL/SQL
display-name= = = APEX
database-username= = = ANONYMOUS
default-page= = = apex
document-table-name= = = wwv_flow_file_objects$
document-path= = = docs
document-procedure= = = wwv_flow_file_mgr.process_download
nls-language= = = american_america.al32utf8
request-validation-function= = = wwv_flow_epg_include_modules.authorize
role-name= = = anonymousServletRole
role-link= = = anonymousServletRole
servlet-name= = = IMAGES
servlet-language= = = PL/SQL
display-name= = = IMAGES
database-username= = = APS
role-name= = = anonymousServletRole
role-link= = = anonymousServletRole
allow-mechanism= = = basic
nonce-timeout= = = 300
xdbcore-xobmem-bound= = = 1024
xdbcore-loadableunit-size= = = 16
acl-evaluation-method= = = ace-order
############# XMLTYPE Tables #############
XDB has 1 XMLTYPE TABLES stored as CLOB
XDB has 24 XMLTYPE TABLES stored as OBJECT-RELATIONAL
XDB has 11 XMLTYPE TABLES stored as BINARY
############# XMLTYPE Columns #############
XDB has 3 XMLTYPE Columns stored as CLOB
MDSYS has 24 XMLTYPE Columns stored as CLOB
SYS has 1 XMLTYPE Columns stored as CLOB
ORDSYS has 9 XMLTYPE Columns stored as CLOB
############# XMLTYPE Views #############
############# XMLTYPE INDEXES #############
XDB has 1 XMLTYPE Indexes of type CSX
############# Items built with XML API's #############
PACKAGE BODY FLOWS_030100.WWV_FLOW_XLIFF
PACKAGE BODY FLOWS_030000.WWV_FLOW_XLIFF
PACKAGE BODY MDSYS.SDO_WFS_PROCESS
PACKAGE BODY EXFSYS.DBMS_RLMGR_DR
PACKAGE BODY FLOWS_030100.WWV_FLOW_DATALOAD_XML
PACKAGE BODY MDSYS.SDO_OLS
PACKAGE BODY FLOWS_030000.WWV_FLOW_DATALOAD_XML
PACKAGE BODY FLOWS_030100.WWV_FLOW_XLIFF
PACKAGE BODY FLOWS_030000.WWV_FLOW_XLIFF
PACKAGE BODY EXFSYS.DBMS_RLMGR_DR
PACKAGE BODY XDB.DBMS_XSLPROCESSOR
PACKAGE BODY XDB.DBMS_XMLPARSER
PACKAGE BODY FLOWS_030100.WWV_FLOW_XLIFF
PACKAGE BODY XDB.DBMS_CSX_INT
PACKAGE BODY FLOWS_030000.WWV_FLOW_XLIFF
PACKAGE BODY EXFSYS.DBMS_RLMGR_DR
PACKAGE BODY XDB.DBMS_XDB
PACKAGE BODY XDB.DBMS_XDBRESOURCE
PACKAGE BODY XDB.DBMS_XMLDOM
PACKAGE XDB.DBMS_XSLPROCESSOR
PACKAGE XDB.DBMS_XMLPARSER
PACKAGE XDB.DBMS_XDBRESOURCE
PACKAGE BODY XDB.DBMS_XMLDOM
PACKAGE BODY XDB.DBMS_XMLINDEX
PACKAGE BODY XDB.DBMS_XMLPARSER
PACKAGE BODY XDB.DBMS_XMLPARSER
PACKAGE BODY XDB.DBMS_XMLSCHEMA
PACKAGE BODY XDB.DBMS_XMLSCHEMA
PACKAGE BODY XDB.DBMS_XMLSCHEMA_INT
PACKAGE BODY XDB.DBMS_XMLTRANSLATIONS
PACKAGE BODY XDB.DBMS_XSLPROCESSOR
PACKAGE BODY XDB.DBMS_XMLPARSER
PACKAGE BODY XDB.DBMS_CSX_INT
PACKAGE BODY XDB.DBMS_XMLDOM
PACKAGE BODY XDB.DBMS_XSLPROCESSOR
############# XML SCHEMAS #############
MDSYS has 4 registered.
EXFSYS has 2 registered.
ORDSYS has 17 registered.
XDB has 25 registered.
SYS has 43 registered.
############# Repository Resources #############
MDSYS has 9 resources.
EXFSYS has 3 resources.
ORDSYS has 20 resources.
XDB has 28 resources.
SYS has 12634 resources.
############# Network ACLs Configured #############
mail.4aps.be has network acls configured for ports 25 through 25
* has network acls configured for ports through
* has network acls configured for ports through
############# DBMS_EPG DAD USAGE #############
APEX
IMAGESHi Jules,
You need a user with XDBADMIN rights to access the WebDav. Once you have access, you can open the URL as webfolder (in IE).
Regards,
Christian -
Generating XML File with Table data...
Hi All,
Bear with me, with my Oracle XML knowledge,,,
we have Oracle 8i ( Relaease 3) as our database, and managegement want to have XML type of Text file, with respect to data in the Customer Table. Expected XML tags would be the Column Names of the Table.
Table has three columns,, Name, Address, Telephone.
So desired XML file looks like below:
<Name>John Hunter</Name><Address> City Road, London</Address><Telephone>1223223</Telephone>
If I deceided to do this task using PL/SQL, how could I start it,,,, All comments are welcome, this is the first time that I am going to generate this type of file ,,,Hi Chandana,
You can check out the DBMS_XMLQUERY package for this purpose. It provides XMLType functionality in Oracle 8i. You can access the documentation for the same at:
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_xmlque.htm#ARPLS066
If you happen to have access to Oracle 9i, then you can use XMLType Views provided with XML DB for your requirement.
Thanks
Shefali
Maybe you are looking for
-
Swap items from Sales Document to Billing Document
Hello, I am facing with the following issue. We had customizing a Billing plan, that means that the information to make the billing document comes from the sales order. The sales document have 2 materials for sale, the first one must be delivered (it
-
OBPM 10g while calling web service getting error
Hi all, I am facing problem while calling webservice from oracleBPM 10G , this is webservice method name zwsticketinginService.zwsCreateTicket( attachement : "X", callbackinf : "phone", callbackmeth : "mailid", category : "Problem", chdate : "2011-10
-
Hi Gurus, When i am working with Offline Dataform at the time of launching a business rule it gives an error . Error is Like: Can not launch rule: AddExistAsset - Can not launch business rule: AddExistAsset Please suggest me what can i do to resolve
-
Hello, I currently own a Power Mac G5 buily in early 2005. I need HELP!
Hello, I currently own a Power Mac G5 buily in early 2005. I can not install and run the new software that is for the Intel Mac's. I believe the early Mac Pro G5 Desktops did not have the intel CPU processors. Can anybody tell me if there a way aroun
-
Use case for describing a web service
Dear all, I have a fundamental question for describing a web service. An analyst will first write (1) a use case for describing the web service and (2) wsdl and xsd files for describing the web service. As a developer, I would say that artifact (2) i