Reading an xml file as an oracle external table
March 15, 2012 Leave a comment
There is a couple of posts around that imply or claim an oracle external table to be able to read xml files by design. This is not true, really. It may work for you or actually may fit your current xml file structure but you should generally not approach to read xml by external tables. Here is why.
What external tables or sql loader for better can do actually is reading line oriented, file based data in bulk and quite fast. It offers a lot of settings to parametrize the loading process, the reader, according to your input format. You may for example have a look at the excellent series of posts discussing this options by Jiri starting here Oracle External Tables by Examples part 1 – TAB delimited fields.
Well, this functionality, may also be (mis)used to read xml instances from files. Given a file as the following one may be interested in extracting the contents of the token tags.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <FILE_INFO> <PERSON_BILD> <token_row><token>Fritz & Fischer</token></token_row> <token_row><token>Boris Borsberg</token></token_row> </PERSON_BILD> </FILE_INFO>
Some external table definition may then look like this:



Recent Comments