如何获取xml文件数据并将其存储到oracle数据库中

时间:2015-01-11 13:26:26

标签: sql xml oracle stored-procedures

我有一个用例,我必须以移动设备的形式从中获取数据  xml并将该数据存储到oracle数据库中。有人可以建议我怎么写  oracle中的一个存储过程,它以xml的形式获取数据作为新参数  到oracle。 xml数据将采用以下格式: -

<?xml version="1.0"?>
<ScheduleData_GPLevel>
  <!-- << Start >>for login XML data-->
  <L_Authenticate>
    <!-- User ID detail-->
    <Uid></Uid>
    <!-- User password, should be MD5 hash generated-->
    <Pwd></Pwd>
  </L_Authenticate>
  <!-- << Start >>for login XML data-->
  <!-- << Start >>Part A schedule form XML data-->
  <CCE_SCH_PART_A_Data>
    <CCE_SCH_PART_A>
      <SCHEDULEID>136</SCHEDULEID>
      <SURVEYINITIATEID>154</SURVEYINITIATEID>
      <SURVEYYEAR>2012-13</SURVEYYEAR>
      <DEPARTMENTID></DEPARTMENTID>
      <SEASONCODE>02</SEASONCODE>
      <SEASONNAME>Winter</SEASONNAME>
      <DIVISIONID>01</DIVISIONID>
      <DIVISIONNAME>Presidency</DIVISIONNAME>
      <DISTRICTID>01</DISTRICTID>
      <DISTRICTNAME>Bankura</DISTRICTNAME>
      <SUBDIVISIONID>02</SUBDIVISIONID>
      <SUBDIVISIONNAME>Sub Div Bankura</SUBDIVISIONNAME>
      <BLOCKID>44</BLOCKID>
      <BLOCKNAME>Block-1</BLOCKNAME>
      <GRAMPANCHAYATID>01</GRAMPANCHAYATID>
      <GRAMPANCHAYATNAME>Gram Panchayat ist</GRAMPANCHAYATNAME>
      <MAUZAID>37</MAUZAID>
      <MAUZANAME>Nandaid</MAUZANAME>
      <UNITNO></UNITNO>
      <CROPCUTDATE></CROPCUTDATE>
      <HALFSAMPLE>IPNS-1</HALFSAMPLE>
      <PLOTID>1650</PLOTID>
      <LANDAREA></LANDAREA>
      <OWNERSALUTAION></OWNERSALUTAION>
      <OWNERNAME></OWNERNAME>
      <OWNERADDRESS></OWNERADDRESS>
      <OWNERVILLAGE></OWNERVILLAGE>
      <OWNERPO></OWNERPO>
      <OWNERTHANA></OWNERTHANA>
      <REMARKS> </REMARKS>
      <STATUS></STATUS>
      <CROPID>5</CROPID>
      <ISMIXEDCROP></ISMIXEDCROP>
      <CROPPEDAREA></CROPPEDAREA>
      <ACTUALCROPPEDAREA></ACTUALCROPPEDAREA>
      <CROPTEDAREAINHECT></CROPTEDAREAINHECT>
      <INFORMANTNAME></INFORMANTNAME>
      <INFORMANTSTATUSID></INFORMANTSTATUSID>
      <ISCIRCULAR></ISCIRCULAR>
      <ISBLOCKCUTTING>1</ISBLOCKCUTTING>
      <ISDRYWTREQUIRE></ISDRYWTREQUIRE>
      <SAMPLEDETAILSID>284</SAMPLEDETAILSID>
    </CCE_SCH_PART_A>
  </CCE_SCH_PART_A_Data>
  <!-- << END >>Part A schedule form XML data-->
  <!-- <<START>>Part B&C schedule form XML data-->
  <CCE_SCH_PART_BC_Data>
    <CCE_SCH_PART_BC>
      <SCHEDULEID>136</SCHEDULEID>
      <LENGTHOFPLOTINSTEPS></LENGTHOFPLOTINSTEPS>
      <BREADTHOFPLOTINSTEPS></BREADTHOFPLOTINSTEPS>
      <RANDOMNOX></RANDOMNOX>
      <RANDOMNOY></RANDOMNOY>
      <NEWRANDOMNOX></NEWRANDOMNOX>
      <NEWRANDOMNOY></NEWRANDOMNOY>
      <FIRSTSAMPLE></FIRSTSAMPLE>
      <SECONDSAMPLE></SECONDSAMPLE>
      <THIRDSAMPLE></THIRDSAMPLE>
      <TOTALSAMPLE></TOTALSAMPLE>
      <ACTUALGREENWEIGHT></ACTUALGREENWEIGHT>
      <DRIAGELASTDATE></DRIAGELASTDATE>
      <TOTALGREENWT></TOTALGREENWT>
      <DRYWT></DRYWT>
      <RATIO></RATIO>
      <REMARKS></REMARKS>
    </CCE_SCH_PART_BC>
  </CCE_SCH_PART_BC_Data>
  <!-- <<END>>Part B&C schedule form XML data-->
  <!-- <<START>>Part D schedule form XML data-->
  <CCE_SCH_PART_D_Data>
    <CCE_SCH_PART_D>
      <SCHEDULEID>136</SCHEDULEID>
      <CROPQUALITYID></CROPQUALITYID>
      <POORQUALITYCROPID></POORQUALITYCROPID>
      <CROPVARIETYID></CROPVARIETYID>
      <RICEQUALITYID></RICEQUALITYID>
      <VARIETYNAME></VARIETYNAME>
      <RICENAME></RICENAME>
      <LANDTYPEID></LANDTYPEID>
      <RAINMEASUREID></RAINMEASUREID>
      <SEEDSOURCEID></SEEDSOURCEID>
      <SEEDTYPEID></SEEDTYPEID>
      <SEEDPERHECTARE></SEEDPERHECTARE>
      <ISSEEDTESTED></ISSEEDTESTED>
      <ISFERTILIZERUSED></ISFERTILIZERUSED>
      <ISLANDIRRIGATION></ISLANDIRRIGATION>
      <IRRIGATIONSOURCEID></IRRIGATIONSOURCEID>
      <IRRIGATIONTIMES></IRRIGATIONTIMES>
      <IRRIGATIONTIMEID></IRRIGATIONTIMEID>
      <IRRIGATIONREQUIREID></IRRIGATIONREQUIREID>
      <ISPESTICIDEUSED></ISPESTICIDEUSED>
      <USEDTIMENO></USEDTIMENO>
      <ISPESTATTACKED></ISPESTATTACKED>
      <ISMODERNTECHUSED></ISMODERNTECHUSED>
      <SOWINGPROCESSID></SOWINGPROCESSID>
      <WEEDINGDONE></WEEDINGDONE>
      <CULTIVATIONNATURE></CULTIVATIONNATURE>
      <REMARKS></REMARKS>
      <ISCONSULTAION></ISCONSULTAION>
      <ISCROPLOAN></ISCROPLOAN>
      <CONSULTAIONSRCID></CONSULTAIONSRCID>
      <ISCROPLOAN></ISCROPLOAN>
      <LOANSRCID></LOANSRCID>
      <ISCULTIVATIONWITHMODTECH></ISCULTIVATIONWITHMODTECH>
    </CCE_SCH_PART_D>
  </CCE_SCH_PART_D_Data>
  <!-- <<END>>Part D schedule form XML data-->
  <!-- <<START>>Primary worker remarks  of Part D in XML data-->
  <CCE_SCH_PRY_WORKER_REM_Data>
    <CCE_SCH_PRY_WORKER_REM>
      <CCE_SCH_PRY_SCHEDULEID>136</CCE_SCH_PRY_SCHEDULEID>
      <CCE_SCH_PRY_LOGINNAME></CCE_SCH_PRY_LOGINNAME>
      <CCE_SCH_PRY_DESIGNATION_CODE></CCE_SCH_PRY_DESIGNATION_CODE>
      <CCE_SCH_PRY_COMMENT></CCE_SCH_PRY_COMMENT>
    </CCE_SCH_PRY_WORKER_REM>
  </CCE_SCH_PRY_WORKER_REM_Data>
  <!-- <<START>>Primary worker remarks Part D in XML data-->
  <!-- <<START>>Inspecting Officials on Spot Comments on Experiment of Part D  in XML data-->
  <CCE_SCH_SUPERIOR_Data>
    <CCE_SCH_SUPERIOR>
      <SCHEDULEID>136</SCHEDULEID>
      <LOGINNAME></LOGINNAME>
      <DESIGNATIONID></DESIGNATIONID>
      <INSPECTIONDATE></INSPECTIONDATE>
      <INSPECTIONTIME></INSPECTIONTIME>
      <PEROFRYWORKER></PEROFRYWORKER>
      <OVERALLPERCEPTION></OVERALLPERCEPTION>
      <DEPARTMENTID></DEPARTMENTID>
      <DEPOTHERS></DEPOTHERS>
      <NAME></NAME>
    </CCE_SCH_SUPERIOR>
  </CCE_SCH_SUPERIOR_Data>
  <!-- <<END>>Inspecting Officials on Spot Comments on Experiment of Part D in XML data-->
  <!-- <<START>>Fertilizer data of Part D in XML data-->
  <CCE_SCH_FERTILIZER_Data>
    <CCE_SCH_FERTILIZER>
      <SCHEDULEID>136</SCHEDULEID>
      <FERTILIZERID></FERTILIZERID>
      <QUANTITY></QUANTITY>
      <FERTILIZERTYPE></FERTILIZERTYPE>
    </CCE_SCH_FERTILIZER>
  </CCE_SCH_FERTILIZER_Data>
  <!-- <<END>>Fertilizer data of Part D in XML data-->
  <!-- <<START>>Pesticide data of Part D in XML data-->
  <CCE_SCH_PESTICIDE_Data>
    <CCE_SCH_PESTICIDE>
      <SCHEDULEID>136</SCHEDULEID>
      <PESTICIDENAME></PESTICIDENAME>
    </CCE_SCH_PESTICIDE>
  </CCE_SCH_PESTICIDE_Data>
  <!-- <<END>>Pesticide data of Part D in XML data-->
  <!-- <<START>>Schdedule validation/error failed stored in XML data-->
  <CCE_SCH_ERR_TRANS_Data>
    <CCE_SCH_ERR_TRANS>
      <SCHEDULEID></SCHEDULEID>
      <ErrorID></ErrorID>
    </CCE_SCH_ERR_TRANS>
  </CCE_SCH_ERR_TRANS_Data>
  <!-- <<END>>Schdedule validation/error failed stored in XML data-->
  <!-- <<START>>Witness detail of Part-a stored in XML data-->
  <CCE_CROP_CUTTING_WITNESS_SCH_A_Data>
    <CCE_CROP_CUTTING_WITNESS_SCH_A>
      <CCE_CROP_CUT_SCHEDULEID>136</CCE_CROP_CUT_SCHEDULEID>
      <CCE_CROP_CUT_NAME></CCE_CROP_CUT_NAME>
      <CCE_CROP_CUT_POSTOFFICE></CCE_CROP_CUT_POSTOFFICE>
      <CCE_CROP_CUT_VILLAGENAME></CCE_CROP_CUT_VILLAGENAME>
      <CCE_CROP_CUT_THANA></CCE_CROP_CUT_THANA>
    </CCE_CROP_CUTTING_WITNESS_SCH_A>
  </CCE_CROP_CUTTING_WITNESS_SCH_A_Data>
  <!-- <<END>>Witness detail of Part-a stored in XML data-->
<!-- <<START>>In case of Mixed crop of Part-a stored in XML data-->
  <CCE_CROP_SCH_A_Data>
    <CCE_CROP_SCH_A>
      <CCE_CROP_SCH_ID>136</CCE_CROP_SCH_ID>
      <CCE_CROP_SCH_SCHEDULEID></CCE_CROP_SCH_SCHEDULEID>
      <CCE_CROP_SCH_CROPID></CCE_CROP_SCH_CROPID>
      <CCE_CROP_SCH_CROP_PERCENTAGE></CCE_CROP_SCH_CROP_PERCENTAGE>
    </CCE_CROP_SCH_A>
  </CCE_CROP_SCH_A_Data>
<!-- <<END>>In case of Mixed crop of Part-a stored in XML data-->
</ScheduleData_GPLevel>

根据用户的喜好,此xml数据中可以有n个子节点。谢谢您的宝贵支持。

2 个答案:

答案 0 :(得分:0)

简单地

CREATE TABLE MY_TABLE (xml_col XMLTYPE);

INSERT INTO MY_TABLE (xml_col) VALUES (XMLTYPE('<?xml version="1.0"?>
<ScheduleData_GPLevel>....'));

答案 1 :(得分:0)

Did this by myself using the following stored procedure .....

create or replace 
PROCEDURE SP_CCE_INSERTSCHEDULEDATA( 
CCE_SCHEDULE_DETAILS IN XMLTYPE 
) 
IS 
BEGIN 
FOR I IN ( 
SELECT XMLTYPE.EXTRACT (VALUE (A),'/CCESchedulePartAData/ACTUALCROPPEDAREA/text()').GETSTRINGVAL() AS ACTUALCROPPEDAREA, 
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/BLOCKID/text()').GETSTRINGVAL() AS BLOCKID, 
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/BLOCKNAME/text()').GETSTRINGVAL () AS BLOCKNAME, 
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/CROPCUTDATE/text()').GETSTRINGVAL () AS CROPCUTDATE, 
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/CROPID/text()').GETSTRINGVAL () AS CROPID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/CROPPEDAREA/text()').GETSTRINGVAL () AS CROPPEDAREA,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/CROPTEDAREAINHECT/text()').GETSTRINGVAL () AS CROPTEDAREAINHECT,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/DEPARTMENTID/text()').GETSTRINGVAL () AS PARTADEPARTMENTID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/DISTRICTID/text()').GETSTRINGVAL () AS DISTRICTID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/DISTRICTNAME/text()').GETSTRINGVAL () AS DISTRICTNAME,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/DIVISIONID/text()').GETSTRINGVAL () AS DIVISIONID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/DIVISIONNAME/text()').GETSTRINGVAL () AS DIVISIONNAME,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/GRAMPANCHAYATID/text()').GETSTRINGVAL () AS GRAMPANCHAYATID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/GRAMPANCHAYATNAME/text()').GETSTRINGVAL () AS GRAMPANCHAYATNAME,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/HALFSAMPLE/text()').GETSTRINGVAL () AS HALFSAMPLE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/INFORMANTNAME/text()').GETSTRINGVAL () AS INFORMANTNAME,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/INFORMANTSTATUSID/text()').GETSTRINGVAL () AS INFORMANTSTATUSID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/ISBLOCKCUTTING/text()').GETSTRINGVAL () AS ISBLOCKCUTTING,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/ISCIRCULAR/text()').GETSTRINGVAL () AS ISCIRCULAR,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/ISDRYWTREQUIRE/text()').GETSTRINGVAL () AS ISDRYWTREQUIRE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/ISMIXEDCROP/text()').GETSTRINGVAL () AS ISMIXEDCROP,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/LANDAREA/text()').GETSTRINGVAL () AS LANDAREA,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/MAUZAID/text()').GETSTRINGVAL () AS MAUZAID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/MAUZANAME/text()').GETSTRINGVAL () AS MAUZANAME,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/OWNERADDRESS/text()').GETSTRINGVAL () AS OWNERADDRESS,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/OWNERNAME/text()').GETSTRINGVAL () AS OWNERNAME,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/OWNERPO/text()').GETSTRINGVAL () AS OWNERPO,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/OWNERSALUTAION/text()').GETSTRINGVAL () AS OWNERSALUTAION,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/OWNERTHANA/text()').GETSTRINGVAL () AS OWNERTHANA,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/OWNERVILLAGE/text()').GETSTRINGVAL () AS OWNERVILLAGE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/PLOTID/text()').GETSTRINGVAL () AS PLOTID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/REMARKS/text()').GETSTRINGVAL () AS PARTAREMARKS,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/SAMPLEDETAILSID/text()').GETSTRINGVAL () AS SAMPLEDETAILSID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/SCHEDULEID/text()').GETSTRINGVAL () AS PARTASCHEDULEID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/SEASONCODE/text()').GETSTRINGVAL () AS SEASONCODE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/STATUS/text()').GETSTRINGVAL () AS STATUS,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/SUBDIVISIONID/text()').GETSTRINGVAL () AS SUBDIVISIONID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/SUBDIVISIONNAME/text()').GETSTRINGVAL () AS SUBDIVISIONNAME,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/SURVEYINITIATEID/text()').GETSTRINGVAL () AS SURVEYINITIATEID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/SURVEYYEAR/text()').GETSTRINGVAL () AS SURVEYYEAR,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/UNITNO/text()').GETSTRINGVAL () AS UNITNO,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartAData/CREATEDBY/text()').GETSTRINGVAL () AS CREATEDBY
FROM TABLE (XMLSEQUENCE (CCE_SCHEDULE_DETAILS.EXTRACT ('/ScheduleData_GPLevel/CCE_SCH_PART_A_Data/CCESchedulePartAData')) ) A ) 
LOOP
INSERT
INTO CCE_SCH_PART_A(SCHEDULEID,SURVEYINITIATEID,GRAMPANCHAYATID,UNITNO,CROPCUTDATE,HALFSAMPLE,
PLOTID,LANDAREA,OWNERSALUTAION,OWNERNAME,OWNERADDRESS,OWNERVILLAGE,OWNERPO,OWNERTHANA,REMARKS,STATUS,
CROPID,DEPARTMENTID,BLOCKID,MAUZAID,ISMIXEDCROP,CROPPEDAREA,ACTUALCROPPEDAREA,CROPTEDAREAINHECT,INFORMANTNAME,
INFORMANTSTATUSID,ISCIRCULAR,ISBLOCKCUTTING,ISDRYWTREQUIRE,SAMPLEDETAILSID,CREATEDBY,CREATEDDATE,CREATEDCLIENTIP)VALUES
  (
  I.PARTASCHEDULEID,I.SURVEYINITIATEID,I.GRAMPANCHAYATID,I.UNITNO,I.CROPCUTDATE,I.HALFSAMPLE,
  I.PLOTID,I.LANDAREA,I.OWNERSALUTAION,I.OWNERNAME,I.OWNERADDRESS,I.OWNERVILLAGE,I.OWNERPO,
  I.OWNERTHANA,I.PARTAREMARKS,I.STATUS,I.CROPID,I.PARTADEPARTMENTID,I.BLOCKID,I.MAUZAID,I.ISMIXEDCROP,
  I.CROPPEDAREA,I.ACTUALCROPPEDAREA,I.CROPTEDAREAINHECT,I.INFORMANTNAME,I.INFORMANTSTATUSID,
  I.ISCIRCULAR,I.ISBLOCKCUTTING,I.ISDRYWTREQUIRE,I.SAMPLEDETAILSID,I.CREATEDBY,SYSDATE,110.20
  );
END LOOP; 
FOR I3 IN(
SELECT XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/ACTUALGREENWEIGHT/text()').GETSTRINGVAL () AS ACTUALGREENWEIGHT,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/BREADTHOFPLOTINSTEPS/text()').GETSTRINGVAL () AS BREADTHOFPLOTINSTEPS,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/DRIAGELASTDATE/text()').GETSTRINGVAL () AS DRIAGELASTDATE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/DRYWT/text()').GETSTRINGVAL () AS DRYWT,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/FIRSTSAMPLE/text()').GETSTRINGVAL () AS FIRSTSAMPLE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/LENGTHOFPLOTINSTEPS/text()').GETSTRINGVAL () AS LENGTHOFPLOTINSTEPS,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/NEWRANDOMNOX/text()').GETSTRINGVAL () AS NEWRANDOMNOX,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/NEWRANDOMNOY/text()').GETSTRINGVAL () AS NEWRANDOMNOY,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/RANDOMNOX/text()').GETSTRINGVAL () AS RANDOMNOX,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/RANDOMNOY/text()').GETSTRINGVAL () AS RANDOMNOY,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/RATIO/text()').GETSTRINGVAL () AS RATIO,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/REMARKS/text()').GETSTRINGVAL () AS PARTBCREMARKS,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/SCHEDULEID/text()').GETSTRINGVAL () AS PARTBCSCHEDULEID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/SECONDSAMPLE/text()').GETSTRINGVAL () AS SECONDSAMPLE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/THIRDSAMPLE/text()').GETSTRINGVAL () AS THIRDSAMPLE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/TOTALGREENWT/text()').GETSTRINGVAL () AS TOTALGREENWT,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartBCData/TOTALSAMPLE/text()').GETSTRINGVAL () AS TOTALSAMPLE
FROM TABLE (XMLSEQUENCE (CCE_SCHEDULE_DETAILS.EXTRACT ('ScheduleData_GPLevel/CCE_SCH_PART_BC_Data/CCESchedulePartBCData')) ) A ) 
LOOP
INSERT
INTO CCE_SCH_PART_BC(ID, SCHEDULEID,LENGTHOFPLOTINSTEPS,BREADTHOFPLOTINSTEPS,
RANDOMNOX,RANDOMNOY,NEWRANDOMNOX,NEWRANDOMNOY,FIRSTSAMPLE,SECONDSAMPLE,THIRDSAMPLE,TOTALSAMPLE,
ACTUALGREENWEIGHT,DRIAGELASTDATE,TOTALGREENWT,DRYWT,RATIO,REMARKS,CREATEDBY,CREATEDDATE,CREATEDCLIENTIP)VALUES
  (
SEQ_CCE_SCH_PART_BC_ID.NextVal,I3.PARTBCSCHEDULEID,I3.LENGTHOFPLOTINSTEPS,I3.BREADTHOFPLOTINSTEPS,I3.RANDOMNOX,I3.RANDOMNOY,
     I3.NEWRANDOMNOX,I3.NEWRANDOMNOY,I3.FIRSTSAMPLE,I3.SECONDSAMPLE,I3.THIRDSAMPLE,I3.TOTALSAMPLE,
     I3.ACTUALGREENWEIGHT,I3.DRIAGELASTDATE,I3.TOTALGREENWT,I3.DRYWT,I3.RATIO,I3.PARTBCREMARKS,11,sysdate,110.20
  );
END LOOP;
FOR I4 IN(
SELECT XMLTYPE.EXTRACT(VALUE (A), '/CCESchedulePartDData/CONSULTAIONSRCID/text()').GETSTRINGVAL () AS CONSULTAIONSRCID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/CROPQUALITYID/text()').GETSTRINGVAL () AS CROPQUALITYID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/CROPVARIETYID/text()').GETSTRINGVAL () AS CROPVARIETYID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/CULTIVATIONNATURE/text()').GETSTRINGVAL () AS CULTIVATIONNATURE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/IRRIGATIONREQUIREID/text()').GETSTRINGVAL () AS IRRIGATIONREQUIREID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/IRRIGATIONSOURCEID/text()').GETSTRINGVAL () AS IRRIGATIONSOURCEID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/IRRIGATIONTIMEID/text()').GETSTRINGVAL () AS IRRIGATIONTIMEID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/IRRIGATIONTIMES/text()').GETSTRINGVAL () AS IRRIGATIONTIMES,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISCONSULTAION/text()').GETSTRINGVAL () AS ISCONSULTAION,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISCULTIVATIONWITHMODTECH/text()').GETSTRINGVAL () AS ISCULTIVATIONWITHMODTECH,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISFERTILIZERUSED/text()').GETSTRINGVAL () AS ISFERTILIZERUSED,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISLANDIRRIGATION/text()').GETSTRINGVAL () AS ISLANDIRRIGATION,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISMODERNTECHUSED/text()').GETSTRINGVAL () AS ISMODERNTECHUSED,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISPESTATTACKED/text()').GETSTRINGVAL () AS ISPESTATTACKED,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISPESTICIDEUSED/text()').GETSTRINGVAL () AS ISPESTICIDEUSED,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISSEEDTESTED/text()').GETSTRINGVAL () AS ISSEEDTESTED,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/LANDTYPEID/text()').GETSTRINGVAL () AS LANDTYPEID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/LOANSRCID/text()').GETSTRINGVAL () AS LOANSRCID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/POORQUALITYCROPID/text()').GETSTRINGVAL () AS POORQUALITYCROPID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/RAINMEASUREID/text()').GETSTRINGVAL () AS RAINMEASUREID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/REMARKS/text()').GETSTRINGVAL () AS PARTDREMARKS,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/RICENAME/text()').GETSTRINGVAL () AS RICENAME,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/RICEQUALITYID/text()').GETSTRINGVAL () AS RICEQUALITYID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/SCHEDULEID/text()').GETSTRINGVAL () AS PARTDSCHEDULEID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/SEEDPERHECTARE/text()').GETSTRINGVAL () AS SEEDPERHECTARE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/SEEDSOURCEID/text()').GETSTRINGVAL () AS SEEDSOURCEID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/SEEDTYPEID/text()').GETSTRINGVAL () AS SEEDTYPEID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/SOWINGPROCESSID/text()').GETSTRINGVAL () AS SOWINGPROCESSID,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/USEDTIMENO/text()').GETSTRINGVAL () AS USEDTIMENO,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/VARIETYNAME/text()').GETSTRINGVAL () AS VARIETYNAME,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/WEEDINGDONE/text()').GETSTRINGVAL () AS WEEDINGDONE,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISCROPLOAN/text()').GETSTRINGVAL () AS ISCROPLOAN,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/KCC/text()').GETSTRINGVAL () AS KCC,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISINSUREDCROP/text()').GETSTRINGVAL () AS ISINSUREDCROP,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/INSUREDCROPSRC/text()').GETSTRINGVAL () AS INSUREDCROPSRC,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/ISMRKPRD/text()').GETSTRINGVAL () AS ISMRKPRD,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/MRKSRC/text()').GETSTRINGVAL () AS MRKSRC,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/DISTOFMRK/text()').GETSTRINGVAL () AS DISTOFMRK,
XMLTYPE.EXTRACT (VALUE (A), '/CCESchedulePartDData/INSURANCECOMP/text()').GETSTRINGVAL () AS INSURANCECOMP
FROM TABLE (XMLSEQUENCE (CCE_SCHEDULE_DETAILS.EXTRACT ('ScheduleData_GPLevel/CCE_SCH_PART_D_Data/CCESchedulePartDData')) ) A ) 
LOOP
INSERT
INTO CCE_SCH_PART_D(ID, SCHEDULEID,CROPQUALITYID,POORQUALITYCROPID,CROPVARIETYID,RICEQUALITYID,VARIETYNAME,
RICENAME,LANDTYPEID,RAINMEASUREID,SEEDSOURCEID,SEEDTYPEID,SEEDPERHECTARE,ISSEEDTESTED,ISFERTILIZERUSED,
ISLANDIRRIGATION,IRRIGATIONSOURCEID,IRRIGATIONTIMES,IRRIGATIONTIMEID,IRRIGATIONREQUIREID,ISPESTICIDEUSED,
USEDTIMENO,ISPESTATTACKED,ISMODERNTECHUSED,EQUIPMENTTYPEUSEDID,SOWINGPROCESSID,WEEDINGDONE,
CULTIVATIONNATURE,REMARKS,ISCUNSULTAION,CONSULTAIONSRCID,ISCROPLOAN,LOANSRCID,ISCULTIVATIONWITHMODTECH,
ISKCC,ISINSUREDCROP,INSUREDCROPSRC,INSURANCECOMP,ISMRKPRD,MRKSRC,DISTOFMRK,CREATEDBY,CREATEDCLIENTIP,CREATEDDATE)VALUES
  (
  SEQ_CCE_SCH_PART_D.NextVal, I4.PARTDSCHEDULEID,I4.CROPQUALITYID,I4.POORQUALITYCROPID,I4.CROPVARIETYID,I4.RICEQUALITYID,
  I4.RICEQUALITYID,I4.VARIETYNAME,I4.RICENAME,I4.LANDTYPEID,I4.RAINMEASUREID,I4.SEEDSOURCEID,
  I4.SEEDTYPEID,I4.SEEDPERHECTARE,I4.ISSEEDTESTED,I4.ISFERTILIZERUSED,I4.ISLANDIRRIGATION,
  I4.IRRIGATIONSOURCEID,I4.IRRIGATIONTIMES,I4.IRRIGATIONTIMEID,I4.IRRIGATIONREQUIREID,
  I4.ISPESTICIDEUSED,I4.USEDTIMENO,I4.ISPESTATTACKED,I4.ISMODERNTECHUSED,I4.SOWINGPROCESSID,
  I4.WEEDINGDONE,I4.CULTIVATIONNATURE,I4.PARTDREMARKS,I4.ISCONSULTAION,I4.CONSULTAIONSRCID,
  I4.ISCROPLOAN,I4.LOANSRCID,I4.ISCULTIVATIONWITHMODTECH,I4.KCC,I4.ISINSUREDCROP,
  I4.INSUREDCROPSRC,I4.INSURANCECOMP,I4.ISMRKPRD,I4.MRKSRC,I4.DISTOFMRK,11,110.20,sysdate);
END LOOP;

FOR I5 IN(
SELECT XMLTYPE.EXTRACT (VALUE (A), 'CCE_SCH_FERTILIZER/FERTILIZERID/text()').GETSTRINGVAL () AS FERTILIZERID,
XMLTYPE.EXTRACT (VALUE (A), 'CCE_SCH_FERTILIZER/FERTILIZERTYPE/text()').GETSTRINGVAL () AS FERTILIZERTYPE,
XMLTYPE.EXTRACT (VALUE (A), 'CCE_SCH_FERTILIZER/QUANTITY/text()').GETSTRINGVAL () AS QUANTITY,
XMLTYPE.EXTRACT (VALUE (A), 'CCE_SCH_FERTILIZER/SCHEDULEID/text()').GETSTRINGVAL () AS FERTILIZERSCHEDULEID
FROM TABLE (XMLSEQUENCE (CCE_SCHEDULE_DETAILS.EXTRACT ('ScheduleData_GPLevel/CCE_SCH_FERTILIZER_Data/CCE_SCH_FERTILIZER')) ) A ) 
LOOP
INSERT
INTO CCE_SCH_FERTILIZER( ID,
    SCHEDULEID, FERTILIZERID,QUANTITY,FERTILIZERTYPE)
  VALUES (
  SEQ_CCE_SCH_FERTILIZER.NextVal,I5.FERTILIZERSCHEDULEID,I5.FERTILIZERID,I5.QUANTITY,I5.FERTILIZERTYPE
  );
END LOOP;
FOR I9 IN (
SELECT XMLTYPE.EXTRACT (VALUE (A), '/CCE_SCH_ERR_TRANS/ErrorID/text()').GETSTRINGVAL () AS ERRORID,
XMLTYPE.EXTRACT (VALUE (A), '/CCE_SCH_ERR_TRANS/SCHEDULEID/text()').GETSTRINGVAL () AS ERRORSCHEDULEID
FROM TABLE (XMLSEQUENCE (CCE_SCHEDULE_DETAILS.EXTRACT ('ScheduleData_GPLevel/CCE_SCH_ERR_TRANS_Data/CCE_SCH_ERR_TRANS')) ) A ) 
LOOP
INSERT INTO CCE_SCH_ERR_TRANS
  (SCHEDULEID, EID
  ) VALUES
  (
   I9.ERRORSCHEDULEID,
   I9.ERRORID
  );
END LOOP;
END SP_CCE_INSERTSCHEDULEDATA;