aspose file tools*
The moose likes XML and Related Technologies and the fly likes XML data loading in Oracle tables. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML data loading in Oracle tables." Watch "XML data loading in Oracle tables." New topic
Author

XML data loading in Oracle tables.

vidhya subramaniam
Ranch Hand

Joined: Jul 14, 2001
Posts: 91
I have written a shell program that automatically loads xml data into oracle tables.
Here is the code:
cd /work/vsubra/edi/saxon
x=`ls *.xml`
echo $x
for file in ${x}
do
cat ${file} | sed 's$http://xml.cxml.org/schemas/cXML/1.2.007/cXML.dtd$/work/v
subra/edi/cXML007.dtd$g'>${file}.xml
mv ${file}.xml ${file}
echo ${file}
done
z=`ls *.xml`
for xmlfilename in ${z}
do
java com.icl.saxon.StyleSheet /work/vsubra/edi/saxon/${xmlfilename} /work/vsub
ra/edi/saxon/ariba.xsl>/work/vsubra/edi/saxon/${xmlfilename}.xml
a=$?
if [ "$a" -ne "0" ]
then
echo "Error(s) in transforming the file ${xmlfilename}"
mv -f ${xmlfilename} /work/vsubra/edi/error_files/${xmlfilename}
else
echo "Successful transformation of file ${xmlfilename}"
mv -f ${xmlfilename} /work/vsubra/edi/trans_files/${xmlfilename}
echo "Successful in moving the file ${xmlfilename}"
y=`ls *.xml`
for filename in ${y}
do
BKUP_FILE=${filename}`date +%m%d%y%H%M%S`.bkup
echo $BKUP_FILE
mv -f ${filename} /work/vsubra/edi/data/trial1.txt
echo "moved ${filename} to trial1.txt"
sqlldr userid="apps/apps" control="/work/vsubra/edi/control/xmlload.ctl"
b = $?
if [ "$b" -ne "0" ]
then
echo "Error(s), moving the ${filename} into the table omni_xmlfile"
else
echo "Completed moving the ${filename} into the table omni_xmlfile"
fi
mv -f /work/vsubra/edi/data/trial1.txt /work/vsubra/edi/backup/${BKUP_FILE}
c = $?
if [ "$c" -ne "0" ]
then
echo "Error(s), moving the ${filename} into the Backup"
exit
else
echo "Completed moving the ${filename} into the Backup"
fi
print "exec omni_loaddata" | sqlplus -s "apps/apps@nwpprd"
s = $?
if [ "$s" -ne "0" ]
then
echo "Error in loading into the temp table "
else
echo "Successful in loading into the temp table"
fi
done
fi
done
exit

But when I run it it gives me the folllowing error
ORA-29532: Java call terminated by uncaught Java exception:
oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
ORA-06512: at "SYS.DBMS_XMLSAVE", line 91
ORA-06512: at "APPS.ARIBA_TEST_DATA", line 7
ORA-06512: at "APPS.OMNI_LOADDATA", line 16
ORA-06512: at line 1

Can someone explain what error this is and how can I correct it.
Thanks,
Vidhya
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML data loading in Oracle tables.