Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML data loading in Oracle tables.

 
vidhya subramaniam
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic