troubleshooting Question

Converting an XML file to a pipe-delimited file taking long time

Avatar of sunny82
sunny82 asked on
Oracle DatabasePerl
9 Comments4 Solutions1286 ViewsLast Modified:

I am trying to load an xml file to Oracle database. I am first converting the xml to a flat file (pipe-delimited) and then using sql loader to load it to oracle database. The problem is when the xml file has large no of records, it is taking long time just to generate the flat file. For e.g. if the xml has 50000 records, it is taking about 27 mins to genearte the flat file.

Is there any issue with the code? Or how can I make it faster? Or Any alternate approach to loading xml data to oracle table?

Here is the code I am using


use warnings;
use strict;
use XML::XPath;

my($xp) = XML::XPath->new( join('', Record.xml') );
my(@records) = $xp->findnodes( '/Records/Record' );
my($firstTime) = 0;

foreach my $record ( @records ) {
my(@fields) = $xp->find( './child::*', $record )->get_nodelist();
unless ( $firstTime++ ) {
print( join( '|', map { $_->getName() } @fields ), "\n");

print( join( '|', map { $_->string_value() } @fields ), "\n");

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 4 Answers and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros