im trying to create DataBase using OracleXE11 and what im tring to do is create XML tables and input data into them.
Step 1:
CREATE TABLE Customer( customerId int Primary KEY, signUpDate Date NOT NULL, CustomerData XMLTYPE, CustomerAdress XMLTYPE);
Step 2:
CustomerData.xml
<?xml version="1.0"?>
<CustomerData>
<Customer>
<name>Alex Smith</name>
<type>Fleet</type>
<nip>1234567890</nip>
</Customer>
<Customer>
<name>Saly North</name>
<type>person</type>
<nip>2345678901</nip>
</Customer>
<CustomerData>
CustomerAdress.xml
<?xml version="1.0"?>
<CustomerAdress>
<Adress>
<city>Xxxx</city>
<street>Yyyy 2</Street>
<postcode>56-200</postcode>
</Adress>
<Adress>
<city>Zzzz</city>
<Street>Uuuu 5</street>
<postcode>57-300</postcode>
</Adress>
<CustomerAdress>
Step 3:
CREATE OR REPLACE DIRECTORY XMLDIR AS 'C:\xml_files';
Step 4: Now i have a problem because i don't know how to input those data. I've tried to:
INSERT INTO Customer (customerId, signUpDate, CustomerData, CustomerAdress) VALUES (1, to_date('12-05-1970','dd-mm-yyyy'), XMLType(bfilename('XMLDIR', 'CustomerData.xml'), nls_charset_id('AL32UTF8')), XMLType(bfilename('XMLDIR', 'CustomerAdress.xml'), nls_charset_id('AL32UTF8')));
but it returns me 1 row (i know why... because in creating only 1 row using all xml files i've declared)
I wondered... maybe a PROCEDURE (PL/SQL) will help me with it
And another problems are (i need to use them all for update/insert/delete): - Xpath - DOM - SAX - Xquery - creating XML Schema to validate inputed XML File - write XML file from DB to file.xml on Desktop - read XML file.xml from Desktop to DB
Im not even sure if im started well with it.
No comments:
Post a Comment