Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
Some newbie xml questions

Some newbie xml questions

2004-10-11       - By Davey, Alan

Reply:     1     2  


=0D

-- --Original Message-- --
From: Davey, Alan=0D
Sent: Friday, October 08, 2004 3:41 PM
To: 'oracle-l-bounce@(protected) '
Subject: some newbie xml questions

Hi,

I 'm trying to work through the xml examples in the not-so FM and finding
I have more questions than answers. This is on Oracle 9.2.0.5 running
on Windows.

I 've created a simple table:
create table test_po (
po_id integer not null,
po_xml xmltype)
/

Then populated with this simple xml file:
<PurchaseOrder=0D
xmlns:xsi=3D "http://www.w3.org/2001/XMLSchema-instance "
=0D
xsi:noNamespaceSchemaLocation=3D "http://www.oracle.com/xdb/purchaseOrder.x
sd " >
<Reference >ADAMS-20011127121040988PST </Reference >
<Actions >
<Action >
<User >SCOTT </User >
<Date xsi:nil=3D "true "/ >
</Action >
</Actions >
<Reject/ >
<Requestor >Julie P. Adams </Requestor >
<User >ADAMS </User >
<CostCenter >R20 </CostCenter >
<ShippingInstructions >
<name >Julie P. Adams </name >
<address >300 Oracle Parkway, Redwood Shores, CA 94065 </address >
<telephone >650 506 7300 </telephone >
</ShippingInstructions >
<SpecialInstructions >Ground </SpecialInstructions >
<LineItems >
<LineItem ItemNumber=3D "1 " >
<Description >The Ruling Class </Description >
<Part Id=3D "715515012423 " UnitPrice=3D "39.95 " Quantity=3D "2 "/ >
</LineItem >
<LineItem ItemNumber=3D "2 " >
<Description >Diabolique </Description >
<Part Id=3D "037429135020 " UnitPrice=3D "29.95 " Quantity=3D "3 "/ >
</LineItem >
<LineItem ItemNumber=3D "3 " >
<Description >8 1/2 </Description >
<Part Id=3D "037429135624 " UnitPrice=3D "39.95 " Quantity=3D "4 "/ >
</LineItem >
</LineItems >
</PurchaseOrder >

Now, I want to start querying the data. I can extract the description
using the following sql:
adavey@(protected) > ed
Wrote file afiedt.buf

1 select po_id, extract(value(d), '//text() ').getstringval()
description
2 from test_po p,
table(xmlsequence(extract(p.po_xml, '/PurchaseOrder/*//Description '))) d
3* where p.po_id =3D 1
adavey@(protected) > /

PO_ID DESCRIPTION
-- ---- -- -- ---- ---- ---- --
1 The Ruling Class
1 Diabolique
1 8 1/2

So far so good. But no matter what I try, I can 't seem to figure out
how to extract ItemNumber, "Part Id ", Quantity, or UnitPrice. Do the
extract and path strings not work properly for elements without proper
tags around them?? Am I going to have to extract at say the LineItems
level and then use instr/substr to extract this information? Blech.

Other questions: =0D
Does the validation methods work when validating an xml file against a
schema definition (xsd) file? I registered the purchaseOrder.xsd that
was part of this example and recreated the table using the xmltype store
as object relational ... syntax. =0D
CREATE TABLE TEST_PO
(
PO_ID INTEGER,
PO_XML XMLTYPE
)
XMLTYPE COLUMN PO_XML STORE AS OBJECT RELATIONAL
XMLSCHEMA "http://www.oracle/xsd/purchaseOrder.xsd "
ELEMENT "PurchaseOrder "

I loaded this xml document and then in pl/sql did:

declare
xmldoc xmltype;
begin
select po_xml into xmldoc
from test_po
where po_id =3D 1;

xmldoc.schemaValidate();
end;

and received:
declare
*
ERROR at line 1:
ORA-31154 (See ORA-31154.ora-code.com): invalid XML document
ORA-19202 (See ORA-19202.ora-code.com): Error occurred in XML processing
LSX-00343: "Date " is not nillable
ORA-06512 (See ORA-06512.ora-code.com): at "SYS.XMLTYPE ", line 0
ORA-06512 (See ORA-06512.ora-code.com): at line 8

Its possible that the xsd file in the Oracle docs has errors, so I will
have to look at it in more detail.

What are some of the performance issues that you have seen in regards to
XML files? For an upcoming project, I will be dealing with xml files
~17MB in size for an upcoming project. How do I index the po_xml column
to better handle information retrieval? Do I create function based
indexes using the extract() methods for those paths that I will be going
after?

Thanks,
-- ---- ---- ---- ---- ---- ---- ---- ---
Alan Davey



"This information in this e-mail is intended solely=0D
for the addressee and may contain information=0D
which is confidential or privileged. Access to this
e-mail by anyone else is unauthorized. If you=0D
are not the intended recipient, or believe that=0D
you have received this communication in error,=0D
please do not print, copy, retransmit,=0D
disseminate, or otherwise use the information.=0D
Also, please notify the sender that you have=0D
received this e-mail in error, and delete the=0D
copy you received. "
--
http://www.freelists.org/webpage/oracle-l