Loading XML data [message #294219] |
Wed, 16 January 2008 21:02 |
EdSmelly
Messages: 3 Registered: January 2008 Location: Rhode Island
|
Junior Member |
|
|
I'm working through "Hands-On Oracle Database 10g Express Edition for Windows" and one of the exercises is loading XML data into a table. The XML file that I'm trying to load came with the book's CD but I'm getting an error when I try to load it.
The code is:
<?xml version="1.0"?>
<ROWSET>
<ROW>
<AP_NAME>owl</AP_NAME>
<AP_DESCRIPTION>Track feeding habits of owls.</AP_DESCRIPTION>
<AP_VERSION>1.3</AP_VERSION>
<DB_ID>3</DB_ID>
</ROW>
<ROW>
<AP_NAME>finch</AP_NAME>
<AP_DESCRIPTION>Track migration habits of finches.</AP_DESCRIPTION>
<AP_VERSION>1.1</AP_VERSION>
<DB_ID>1</DB_ID>
</ROW>
<ROW>
<AP_NAME>robin</AP_NAME>
<AP_DESCRIPTION>Track population statistics of robins.</AP_DESCRIPTION>
<AP_VERSION>1.0</AP_VERSION>
<DB_ID>2</DB_ID>
</ROW>
</ROWSET>
I don't see any problem with the formatting but obvious;y something is wrong. Any ideas?
Thanks
-ed
|
|
|
|
Re: Loading XML data [message #294237 is a reply to message #294219] |
Wed, 16 January 2008 23:12 |
hobbes
Messages: 173 Registered: January 2006
|
Senior Member |
|
|
The XML looks fine - the problem must lie elsewhere. Please show (copy&paste from your screen) how you are loading the XML, along with the exact error.
|
|
|
|
Re: Loading XML data [message #294324 is a reply to message #294263] |
Thu, 17 January 2008 04:09 |
EdSmelly
Messages: 3 Registered: January 2008 Location: Rhode Island
|
Junior Member |
|
|
Load was via Oracle Application Express.
Utilities->Data Load/Unload->Load->Load XML Data->Select Table->Select File.
Click, click, click, click, XML Load Error.
Here is the table definition:
CREATE TABLE "APPLICATIONS"
( "AP_ID" NUMBER(3,0) NOT NULL ENABLE,
"AP_NAME" VARCHAR2(25) NOT NULL ENABLE,
"AP_DESCRIPTION" VARCHAR2(4000),
"AP_VERSION" VARCHAR2(25) DEFAULT '1.0',
"DB_ID" NUMBER(3,0) NOT NULL ENABLE,
CONSTRAINT "PK_APPLICATIONS" PRIMARY KEY ("AP_ID") ENABLE,
UNIQUE ("AP_NAME") ENABLE,
CONSTRAINT "APPLICATIONS_FK_DB_ID" FOREIGN KEY ("DB_ID")
REFERENCES "DATABASES" ("DB_ID") ENABLE
)
/
CREATE OR REPLACE TRIGGER "APPLICATIONS_TPK"
BEFORE
insert on "APPLICATIONS"
for each row
begin
SELECT handsonxe06.ap_ids.nextval
INTO :new.ap_id
FROM dual;
end;
/
ALTER TRIGGER "APPLICATIONS_TPK" ENABLE
/
|
|
|
Re: Loading XML data [message #294356 is a reply to message #294219] |
Thu, 17 January 2008 05:41 |
hobbes
Messages: 173 Registered: January 2006
|
Senior Member |
|
|
"XML Load Error" doesn't convey any information - isn't there a more descriptive error text?
The XML-table mapping looks OK. Perhaps data constraints are being violated, but we cannot know for sure without the error details.
|
|
|
Re: Loading XML data [message #294368 is a reply to message #294356] |
Thu, 17 January 2008 06:10 |
EdSmelly
Messages: 3 Registered: January 2008 Location: Rhode Island
|
Junior Member |
|
|
hobbes wrote on Thu, 17 January 2008 06:41 | "XML Load Error" doesn't convey any information - isn't there a more descriptive error text?
|
You're right, it doesn't convey any information but that's all there is. I also agree that it's most likely a constraint issue.
I think the best thing to do is to type in the 4 rows manually and get on with things.
|
|
|