#****VARIABLES****# my $username = 'system'; my $password = ''; my $database = "dbi:Oracle:"; my $oradbh; my $xmlSQL; my $sqlXML; my $count=0; my $xmldatafile = "E:\\\\PERLFiles\\trash\\xmldata.xml"; my $datadump = "E:\\\\PERLFiles\\trash\\extract.txt"; #****END VARIABLES****# #****PROGRAM****# $oradbh = DBI->connect($database,$username,$password, {RaiseError => 1, PrintError => 0}) or die ($DBI::errstr, "\n"); #Sets the Long Read Length to accomendate the XML in the RFI_XML column $oradbh -> {LongReadLen} = 30000*256; #SQL setup to extract the XML data from the 8i database $xmlSQL = qq(select rfi_xml from webrater_owner.quote where rownum < 12); $sqlXML = $oradbh->prepare($xmlSQL); $sqlXML -> execute(); my ($xml_sql_data); $sqlXML -> bind_columns(undef, \$xml_sql_data); #Write out all the XML data from RFI_XML to a text/xml file while($sqlXML -> fetch()) { open(FILE,"> $xmldatafile".$count) or die "Unable to open $xmldatafile : $!\n"; foreach($sqlXML) { print FILE $xml_sql_data; } close(FILE) or warn "Unable to close $xmldatafile: $!\n"; print "writing file: ".$xmldatafile.$count."\n"; $count++; } $sqlXML -> finish(); #Finish the SQL command $oradbh -> disconnect; #Disconnect from the database #****END PROGRAM****#