如何提取具有许多节点的xml clob列

时间:2017-06-02 09:20:48

标签: sql xml oracle

我是XMl和Oracle SQL的新手。我们有一个包含列的Oracle表,其中一个列是CLOB,其中包含Xml数据。现在我们必须将所有列(包括clob中的列)加载到第二个表中。现在的问题是,当我们解包clob时,如果我们有超过100条记录,则需要花费大量时间。下面的示例显示了解压缩clob时select语句的工作原理。如果我们删除满足20天的日期文件,下面需要花费很多时间。有没有办法可以改善select语句的性能,或者使用ODI 12c来实现这个目标?我希望我的观点很清楚。

SELECT REG_FORM_ID,
       FORM_TYPE_CD,
       BO_STATUS_CD,
       ACCT_ID,
       PER_ID,
       STATUS_UPD_DTTM,
     L2_CI_REG_FORM_REGISTRATION."etpmTIN"  etpmTIN,
     L2_CI_REG_FORM_REGISTRATION."regType"  regType,
     L2_CI_REG_FORM_REGISTRATION."effectiveDate"    effectiveDate,
     L2_CI_REG_FORM_REGISTRATION."legacyTIN"    legacyTIN,

     L2_CI_REG_FORM_REGISTRATION."businessType" businessType,
     L2_CI_REG_FORM_REGISTRATION."otherBusinessType"    otherBusinessType,
     L2_CI_REG_FORM_REGISTRATION."companyRegNumber" companyRegNumber,
     L2_CI_REG_FORM_REGISTRATION."detailforname"    detailforname,
     L2_CI_REG_FORM_REGISTRATION."detailmaidenName" detailmaidenName,
     L2_CI_REG_FORM_REGISTRATION."detailname"   detailname,
     L2_CI_REG_FORM_REGISTRATION."detailsurname"    detailsurname,
     L2_CI_REG_FORM_REGISTRATION."detailtitle"  detailtitle,

    L2_CI_REG_FORM_REGISTRATION."contemailAddress"  contemailAddress,
    L2_CI_REG_FORM_REGISTRATION."contphoneDetails"  contphoneDetails,
    L2_CI_REG_FORM_REGISTRATION."contphyAddress1"   contphyAddress1,
    L2_CI_REG_FORM_REGISTRATION."contphyAddress2"   contphyAddress2,
    L2_CI_REG_FORM_REGISTRATION."contphyAddress3"   contphyAddress3,
    L2_CI_REG_FORM_REGISTRATION."contphyAddress4"   contphyAddress4,
    L2_CI_REG_FORM_REGISTRATION."contphyCity"   contphyCity,
    L2_CI_REG_FORM_REGISTRATION."contphyCountry"    contphyCountry,
    L2_CI_REG_FORM_REGISTRATION."contphyCounty" contphyCounty,
    L2_CI_REG_FORM_REGISTRATION."contphyPostal" contphyPostal,
    L2_CI_REG_FORM_REGISTRATION."contpostAddress1"  contpostAddress1,
    L2_CI_REG_FORM_REGISTRATION."contpostAddress2"  contpostAddress2,
    L2_CI_REG_FORM_REGISTRATION."contpostAddress3"  contpostAddress3,
    L2_CI_REG_FORM_REGISTRATION."contpostAddress4"  contpostAddress4,
    L2_CI_REG_FORM_REGISTRATION."contpostCity"  contpostCity,
    L2_CI_REG_FORM_REGISTRATION."contpostCountry"   contpostCountry,
    L2_CI_REG_FORM_REGISTRATION."contpostCounty"    contpostCounty,
    L2_CI_REG_FORM_REGISTRATION."contpostNum"   contpostNum,
    L2_CI_REG_FORM_REGISTRATION."contpostPostal"    contpostPostal,
    L2_CI_REG_FORM_REGISTRATION."contpostType"  contpostType,


    L2_CI_REG_FORM_REGISTRATION."accountantName"    accountantName,
    L2_CI_REG_FORM_REGISTRATION."accountantPerID"   accountantPerID,
    L2_CI_REG_FORM_REGISTRATION."accountantphoneDetails"    accountantphoneDetails,
    L2_CI_REG_FORM_REGISTRATION."accountantphyAddress1" accountantphyAddress1,
    L2_CI_REG_FORM_REGISTRATION."accountantphyAddress2" accountantphyAddress2,
    L2_CI_REG_FORM_REGISTRATION."accountantphyAddress3" accountantphyAddress3,
    L2_CI_REG_FORM_REGISTRATION."accountantphyAddress4" accountantphyAddress4,
    L2_CI_REG_FORM_REGISTRATION."accountantphyCity" accountantphyCity,
    L2_CI_REG_FORM_REGISTRATION."accountantphyCountry"  accountantphyCountry,
    L2_CI_REG_FORM_REGISTRATION."accountantphyCounty"   accountantphyCounty,
    L2_CI_REG_FORM_REGISTRATION."accountantphyPostal"   accountantphyPostal,
    L2_CI_REG_FORM_REGISTRATION."accountantpostAddress1"    accountantpostAddress1,
    L2_CI_REG_FORM_REGISTRATION."accountantpostAddress2"    accountantpostAddress2,
    L2_CI_REG_FORM_REGISTRATION."accountantpostAddress3"    accountantpostAddress3,
    L2_CI_REG_FORM_REGISTRATION."accountantpostAddress4"    accountantpostAddress4,
    L2_CI_REG_FORM_REGISTRATION."accountantpostCity"    accountantpostCity,
    L2_CI_REG_FORM_REGISTRATION."accountantpostCountry" accountantpostCountry,
    L2_CI_REG_FORM_REGISTRATION."accountantpostCounty"  accountantpostCounty,
    L2_CI_REG_FORM_REGISTRATION."accountantpostNum" accountantpostNum,
    L2_CI_REG_FORM_REGISTRATION."accountantpostPostal"  accountantpostPostal,
    L2_CI_REG_FORM_REGISTRATION."accountantpostType"    accountantpostType,
    L2_CI_REG_FORM_REGISTRATION."accountantTIN" accountantTIN,

    L2_CI_REG_FORM_REGISTRATION."officeremailAddress"   officeremailAddress,
    L2_CI_REG_FORM_REGISTRATION."officerName"   officerName,
    L2_CI_REG_FORM_REGISTRATION."officerPerID"  officerPerID,
    L2_CI_REG_FORM_REGISTRATION."officerphoneDetails"   officerphoneDetails,
    L2_CI_REG_FORM_REGISTRATION."officerphyAddress1"    officerphyAddress1,
    L2_CI_REG_FORM_REGISTRATION."officerphyAddress2"    officerphyAddress2,
    L2_CI_REG_FORM_REGISTRATION."officerphyAddress3"    officerphyAddress3,
    L2_CI_REG_FORM_REGISTRATION."officerphyAddress4"    officerphyAddress4,
    L2_CI_REG_FORM_REGISTRATION."officerphyCity"    officerphyCity,
    L2_CI_REG_FORM_REGISTRATION."officerphyCountry" officerphyCountry,
    L2_CI_REG_FORM_REGISTRATION."officerphyCounty"  officerphyCounty,
    L2_CI_REG_FORM_REGISTRATION."officerphyPostal"  officerphyPostal,
    L2_CI_REG_FORM_REGISTRATION."officerpostAddress1"   officerpostAddress1,
    L2_CI_REG_FORM_REGISTRATION."officerpostAddress2"   officerpostAddress2,
    L2_CI_REG_FORM_REGISTRATION."officerpostAddress3"   officerpostAddress3,
    L2_CI_REG_FORM_REGISTRATION."officerpostAddress4"   officerpostAddress4,
    L2_CI_REG_FORM_REGISTRATION."officerpostCity"   officerpostCity,
    L2_CI_REG_FORM_REGISTRATION."officerpostCountry"    officerpostCountry,
    L2_CI_REG_FORM_REGISTRATION."officerpostCounty" officerpostCounty,
    L2_CI_REG_FORM_REGISTRATION."officerpostNum"    officerpostNum,
    L2_CI_REG_FORM_REGISTRATION."officerpostPostal" officerpostPostal,
    L2_CI_REG_FORM_REGISTRATION."officerpostType"   officerpostType,
    L2_CI_REG_FORM_REGISTRATION."officerTIN"    officerTIN,

     L2_CI_REG_FORM_REGISTRATION."vatEffectiveDate"  vatEffectiveDate,
     L2_CI_REG_FORM_REGISTRATION."vatReason"     vatReason,
     L2_CI_REG_FORM_REGISTRATION."vatNewOrAcquired"  vatNewOrAcquired,
     L2_CI_REG_FORM_REGISTRATION."vatNumber"     vatNumber,

     L2_CI_REG_FORM_REGISTRATION."payeEffectiveDate"    payeEffectiveDate,
     L2_CI_REG_FORM_REGISTRATION."employeeNumber"   employeeNumber,
     L2_CI_REG_FORM_REGISTRATION."minSalary"    minSalary,
     L2_CI_REG_FORM_REGISTRATION."maxSalary"    maxSalary,



     L2_CI_REG_FORM_REGISTRATION."nonResSvcProvider"    nonResSvcProvider,
     L2_CI_REG_FORM_REGISTRATION."nonResServProdDesc"   nonResServProdDesc,
     L2_CI_REG_FORM_REGISTRATION."resContractors"   resContractors,
     L2_CI_REG_FORM_REGISTRATION."resContractorsDesc"   resContractorsDesc,


     L2_CI_REG_FORM_REGISTRATION."vatTaxRoleId" vatTaxRoleId,
     L2_CI_REG_FORM_REGISTRATION."soleTaxRoleId"    soleTaxRoleId,
     L2_CI_REG_FORM_REGISTRATION."corpTaxRoleId"    corpTaxRoleId,
     L2_CI_REG_FORM_REGISTRATION."payeTaxRoleId"    payeTaxRoleId,
     L2_CI_REG_FORM_REGISTRATION."whtTaxRoleId" whtTaxRoleId,
     L2_CI_REG_FORM_REGISTRATION."approverUserId"   approverUserId,
     L2_CI_REG_FORM_REGISTRATION."fbtTaxRoleId" fbtTaxRoleId,



    L2_CI_REG_FORM_REGISTRATION."correspondenceemailAddress"    correspondenceemailAddress,
    L2_CI_REG_FORM_REGISTRATION."correspondencephoneDetails"    correspondencephoneDetails,
    L2_CI_REG_FORM_REGISTRATION."correspondencephyAddress1" correspondencephyAddress1,
    L2_CI_REG_FORM_REGISTRATION."correspondencephyAddress2" correspondencephyAddress2,
    L2_CI_REG_FORM_REGISTRATION."correspondencephyAddress3" correspondencephyAddress3,
    L2_CI_REG_FORM_REGISTRATION."correspondencephyAddress4" correspondencephyAddress4,
    L2_CI_REG_FORM_REGISTRATION."correspondencephyCity" correspondencephyCity,
    L2_CI_REG_FORM_REGISTRATION."correspondencephyCountry"  correspondencephyCountry,
    L2_CI_REG_FORM_REGISTRATION."correspondencephyCounty"   correspondencephyCounty,
    L2_CI_REG_FORM_REGISTRATION."correspondencephyPostal"   correspondencephyPostal,
    L2_CI_REG_FORM_REGISTRATION."correspondencepostAddress1"    correspondencepostAddress1,
    L2_CI_REG_FORM_REGISTRATION."correspondencepostAddress2"    correspondencepostAddress2,
    L2_CI_REG_FORM_REGISTRATION."correspondencepostAddress3"    correspondencepostAddress3,
    L2_CI_REG_FORM_REGISTRATION."correspondencepostAddress4"    correspondencepostAddress4,
    L2_CI_REG_FORM_REGISTRATION."correspondencepostCity"    correspondencepostCity,
    L2_CI_REG_FORM_REGISTRATION."correspondencepostCountry" correspondencepostCountry,
    L2_CI_REG_FORM_REGISTRATION."correspondencepostCounty"  correspondencepostCounty,
    L2_CI_REG_FORM_REGISTRATION."correspondencepostNum" correspondencepostNum,
    L2_CI_REG_FORM_REGISTRATION."correspondencepostPostal"  correspondencepostPostal,
    L2_CI_REG_FORM_REGISTRATION."correspondencepostType"    correspondencepostType,

    L2_CI_REG_FORM_REGISTRATION."soleidrescountryOfBirth"   soleidrescountryOfBirth,
    L2_CI_REG_FORM_REGISTRATION."soleidrescountryOfCit" soleidrescountryOfCit,
    L2_CI_REG_FORM_REGISTRATION."soleidrescountryOfIssue"   soleidrescountryOfIssue,
    L2_CI_REG_FORM_REGISTRATION."soleidrescountryOfRes" soleidrescountryOfRes,
    L2_CI_REG_FORM_REGISTRATION."soleidresdateOfBirth"  soleidresdateOfBirth,
    L2_CI_REG_FORM_REGISTRATION."soleidresotherCountryOfIssue"  soleidresotherCountryOfIssue,
    L2_CI_REG_FORM_REGISTRATION."soleidresotherID"  soleidresotherID,
    L2_CI_REG_FORM_REGISTRATION."soleidresotherIDNumber"    soleidresotherIDNumber,
    L2_CI_REG_FORM_REGISTRATION."soleidrespassportExpiryDate"   soleidrespassportExpiryDate,
    L2_CI_REG_FORM_REGISTRATION."soleidrespassportNum"  soleidrespassportNum,

    L2_CI_REG_FORM_REGISTRATION."condMarriage"  condMarriage,
    L2_CI_REG_FORM_REGISTRATION."employer"  employer,
    L2_CI_REG_FORM_REGISTRATION."maritalStatus" maritalStatus,
    L2_CI_REG_FORM_REGISTRATION."spouseMaiden"  spouseMaiden,
    L2_CI_REG_FORM_REGISTRATION."spouseName"    spouseName,
    L2_CI_REG_FORM_REGISTRATION."spousePerID"   spousePerID,
    L2_CI_REG_FORM_REGISTRATION."spouseTIN" spouseTIN,



    L2_CI_REG_FORM_REGISTRATION."vatPreviousName"   vatPreviousName,
    L2_CI_REG_FORM_REGISTRATION."vatPreviousTIN"    vatPreviousTIN,
    L2_CI_REG_FORM_REGISTRATION."vatPerID"  vatPerID,
    L2_CI_REG_FORM_REGISTRATION."vatPreviousAddress"    vatPreviousAddress,

        L2_CI_REG_FORM_FBT."fbtType"    fbtType,

    L2_CI_REG_FORM_WITHB."whtType"  whtType,
    L2_CI_REG_FORM_WITHB."whtOther" whtOther ,

    L2_CI_REG_FORM_DIRECTOR."directorName"  directorName,
    L2_CI_REG_FORM_DIRECTOR."directorPerID" directorPerID,
    L2_CI_REG_FORM_DIRECTOR."directorTIN"   directorTIN,

    L2_CI_REG_FORM_TRADENAME."tradeName"    tradeName,
    L2_CI_REG_FORM_TRADENAME."commencementDate" commencementDate,
        L2_CI_REG_FORM_TRADENAME."natureOfBusiness" natureOfBusiness,
    L2_CI_REG_FORM_TRADENAME."traderNumber" traderNumber,


       LOAD_DATE LAST_UPDATE_DATE,
       'I' IND_UPDATE


   FROM L1_CI_REG_FORM,

   XMLTABLE('REGISTRATION'
      PASSING xmltype(L1_CI_REG_FORM.BO_DATA_AREA) 
      COLUMNS 

      "etpmTIN" varchar2(16) PATH 'rsnForReg/etpmTIN/asCurrent',
      "regType" varchar2(6) PATH 'rsnForReg/regType/asCurrent',
      "effectiveDate" DATE PATH 'rsnForReg/effectiveDate/asCurrent',
      "legacyTIN" VARCHAR2(16) PATH 'rsnForReg/legacyTIN/asCurrent',
      "businessType" varchar2(100) PATH 'detailsSection/businessType/asCurrent',
      "otherBusinessType" varchar2(100) PATH 'detailsSection/otherBusinessType/asCurrent',
      "detailname"  VARCHAR2(100)   PATH    'detailsSection/name/asCurrent',
      "companyRegNumber"    VARCHAR2(100)   PATH    'detailsSection/companyRegNumber/asCurrent',
      "detailtitle" VARCHAR2(16)    PATH    'detailsSection/title/asCurrent',
      "detailsurname"   VARCHAR2(100)   PATH    'detailsSection/surname/asCurrent',
      "detailforname"   VARCHAR2(100)   PATH    'detailsSection/forname/asCurrent',
      "detailmaidenName"    VARCHAR2(100)   PATH    'detailsSection/maidenName/asCurrent',
    "contemailAddress" VARCHAR2(100) PATH 'contactSection/emailAddress/asCurrent',
    "contphoneDetails" VARCHAR2(100) PATH 'contactSection/phoneDetails/asCurrent',
    "contphyAddress1" VARCHAR2(100) PATH 'contactSection/phyAddress1/asCurrent',
    "contphyAddress2" VARCHAR2(100) PATH 'contactSection/phyAddress2/asCurrent',
    "contphyAddress3" VARCHAR2(100) PATH 'contactSection/phyAddress3/asCurrent',
    "contphyAddress4" VARCHAR2(100) PATH 'contactSection/phyAddress4/asCurrent',
     "contphyCity" varchar2(100) PATH 'contactSection/phyCity/asCurrent',
     "contphyCountry" varchar2(3) PATH 'contactSection/phyCountry/asCurrent',
     "contphyCounty" varchar2(100) PATH 'contactSection/phyCounty/asCurrent',
    "contphyPostal" VARCHAR2(100) PATH 'contactSection/phyPostal/asCurrent',
    "contpostAddress1" VARCHAR2(100) PATH 'contactSection/postAddress1/asCurrent',
    "contpostAddress2" VARCHAR2(100) PATH 'contactSection/postAddress2/asCurrent',
    "contpostAddress3" VARCHAR2(100) PATH 'contactSection/postAddress3/asCurrent',
    "contpostAddress4" VARCHAR2(100) PATH 'contactSection/postAddress4/asCurrent',
         "contpostCity" varchar2(100) PATH 'contactSection/postCity/asCurrent',
         "contpostCountry" varchar2(3) PATH 'contactSection/postCountry/asCurrent',
     "contpostCounty" varchar2(100) PATH 'contactSection/postCounty/asCurrent',
    "contpostNum" VARCHAR2(100) PATH 'contactSection/postNum/asCurrent',
    "contpostPostal" VARCHAR2(100) PATH 'contactSection/postPostal/asCurrent',
     "contpostType" varchar2(6) PATH 'contactSection/postType/asCurrent',
         "accountantName" varchar2(100) PATH 'accountantSection/name/asCurrent',
    "accountantPerID" varchar2(100) PATH 'accountantSection/PerID/asCurrent',
    "accountantphoneDetails" VARCHAR2(100) PATH 'accountantSection/phoneDetails/asCurrent',
    "accountantphyAddress1" VARCHAR2(100) PATH 'accountantSection/phyAddress1/asCurrent',
    "accountantphyAddress2" VARCHAR2(100) PATH 'accountantSection/phyAddress2/asCurrent',
    "accountantphyAddress3" VARCHAR2(100) PATH 'accountantSection/phyAddress3/asCurrent',
    "accountantphyAddress4" VARCHAR2(100) PATH 'accountantSection/phyAddress4/asCurrent',
    "accountantphyCity" VARCHAR2(100) PATH 'accountantSection/phyCity/asCurrent',
    "accountantphyCountry" VARCHAR2(100) PATH 'accountantSection/phyCountry/asCurrent',
    "accountantphyCounty" VARCHAR2(100) PATH 'accountantSection/phyCounty/asCurrent',
    "accountantphyPostal" VARCHAR2(100) PATH 'accountantSection/phyPostal/asCurrent',
    "accountantpostAddress1" VARCHAR2(100) PATH 'accountantSection/postAddress1/asCurrent',
    "accountantpostAddress2" VARCHAR2(100) PATH 'accountantSection/postAddress2/asCurrent',
    "accountantpostAddress3" VARCHAR2(100) PATH 'accountantSection/postAddress3/asCurrent',
    "accountantpostAddress4" VARCHAR2(100) PATH 'accountantSection/postAddress4/asCurrent',
    "accountantpostCity" VARCHAR2(100) PATH 'accountantSection/postCity/asCurrent',
    "accountantpostCountry" VARCHAR2(100) PATH 'accountantSection/postCountry/asCurrent',
    "accountantpostCounty" VARCHAR2(100) PATH 'accountantSection/postCounty/asCurrent',
    "accountantpostNum" VARCHAR2(100) PATH 'accountantSection/postNum/asCurrent',
    "accountantpostPostal" VARCHAR2(100) PATH 'accountantSection/postPostal/asCurrent',
    "accountantpostType" VARCHAR2(100) PATH 'accountantSection/postType/asCurrent',
    "accountantTIN" VARCHAR2(100) PATH 'accountantSection/TIN/asCurrent',
    "officeremailAddress" VARCHAR2(100) PATH 'officerSection/emailAddress/asCurrent',
     "officerName" varchar2(100) PATH 'officerSection/name/asCurrent',
     "officerPerID" varchar2(16) PATH 'officerSection/PerID/asCurrent',
    "officerphoneDetails" VARCHAR2(100) PATH 'officerSection/phoneDetails/asCurrent',
    "officerphyAddress1" VARCHAR2(100) PATH 'officerSection/phyAddress1/asCurrent',
    "officerphyAddress2" VARCHAR2(100) PATH 'officerSection/phyAddress2/asCurrent',
    "officerphyAddress3" VARCHAR2(100) PATH 'officerSection/phyAddress3/asCurrent',
    "officerphyAddress4" VARCHAR2(100) PATH 'officerSection/phyAddress4/asCurrent',
    "officerphyCity" VARCHAR2(100) PATH 'officerSection/phyCity/asCurrent',
    "officerphyCountry" VARCHAR2(100) PATH 'officerSection/phyCountry/asCurrent',
        "officerphyCounty" VARCHAR2(100) PATH 'officerSection/phyCountry/asCurrent',
    "officerphyPostal" VARCHAR2(100) PATH 'officerSection/phyPostal/asCurrent',
    "officerpostAddress1" VARCHAR2(100) PATH 'officerSection/postAddress1/asCurrent',
    "officerpostAddress2" VARCHAR2(100) PATH 'officerSection/postAddress2/asCurrent',
    "officerpostAddress3" VARCHAR2(100) PATH 'officerSection/postAddress3/asCurrent',
    "officerpostAddress4" VARCHAR2(100) PATH 'officerSection/postAddress4/asCurrent',
    "officerpostCity" VARCHAR2(100) PATH 'officerSection/postCity/asCurrent',
    "officerpostCountry" VARCHAR2(100) PATH 'officerSection/postCountry/asCurrent',
    "officerpostCounty" VARCHAR2(100) PATH 'officerSection/postCounty/asCurrent',
    "officerpostNum" VARCHAR2(100) PATH 'officerSection/postNum/asCurrent',
    "officerpostPostal" VARCHAR2(100) PATH 'officerSection/postPostal/asCurrent',
    "officerpostType" VARCHAR2(100) PATH 'officerSection/postType/asCurrent',
    "officerTIN" varchar2(16) PATH 'officerSection/TIN/asCurrent',
    "vatEffectiveDate" DATE PATH 'vatSection/vatEffectiveDate/asCurrent',
    "vatReason" varchar2(100) PATH 'vatSection/vatReason/asCurrent',
    "vatNewOrAcquired" varchar2(16) PATH 'vatSection/vatNewOrAcquired/asCurrent',
    "vatNumber" varchar2(16) PATH 'vatSection/vatNumber/asCurrent',
    "payeEffectiveDate" DATE PATH 'payeSection/payeEffectiveDate/asCurrent',
    "employeeNumber" varchar2(12) PATH 'payeSection/employeeNumber/asCurrent',
    "minSalary" NUMBER(12,0) PATH 'payeSection/minSalary/asCurrent',
    "maxSalary" NUMBER(12,0) PATH 'payeSection/maxSalary/asCurrent',
    "nonResSvcProvider" varchar2(16) PATH 'whtSection/nonResSvcProvider/asCurrent',
    "nonResServProdDesc" varchar2(100) PATH 'whtSection/nonResServProdDesc/asCurrent',
    "resContractors" varchar2(16) PATH 'whtSection/resContractors/asCurrent',
    "resContractorsDesc" varchar2(100) PATH 'whtSection/resContractorsDesc/asCurrent',
    "vatTaxRoleId" VARCHAR2(16) PATH 'maintenance/vatTaxRoleId/asCurrent',
    "soleTaxRoleId" varchar2(12) PATH 'maintenance/soleTaxRoleId/asCurrent',
    "corpTaxRoleId" VARCHAR2(16) PATH 'maintenance/corpTaxRoleId/asCurrent',
    "payeTaxRoleId" VARCHAR2(16) PATH 'maintenance/payeTaxRoleId/asCurrent',
    "whtTaxRoleId" VARCHAR2(16) PATH 'maintenance/whtTaxRoleId/asCurrent',
        "approverUserId" VARCHAR2(100) PATH 'maintenance/approverUserId/asCurrent',
    "fbtTaxRoleId" VARCHAR2(16) PATH 'maintenance/fbtTaxRoleId/asCurrent',
    "correspondenceemailAddress" VARCHAR2(100) PATH 'soleCorrespondenceSection/emailAddress/asCurrent',
    "correspondencephoneDetails" VARCHAR2(100) PATH 'soleCorrespondenceSection/phoneDetails/asCurrent',
    "correspondencephyAddress1" VARCHAR2(100) PATH 'soleCorrespondenceSection/phyAddress1/asCurrent',
    "correspondencephyAddress2" VARCHAR2(100) PATH 'soleCorrespondenceSection/phyAddress2/asCurrent',
    "correspondencephyAddress3" VARCHAR2(100) PATH 'soleCorrespondenceSection/phyAddress3/asCurrent',
    "correspondencephyAddress4" VARCHAR2(100) PATH 'soleCorrespondenceSection/phyAddress4/asCurrent',
    "correspondencephyCity" VARCHAR2(100) PATH 'soleCorrespondenceSection/phyCity/asCurrent',
    "correspondencephyCountry" VARCHAR2(100) PATH 'soleCorrespondenceSection/phyCountry/asCurrent',
    "correspondencephyCounty" VARCHAR2(100) PATH 'soleCorrespondenceSection/phyCounty/asCurrent',
    "correspondencephyPostal" VARCHAR2(100) PATH 'soleCorrespondenceSection/phyPostal/asCurrent',
    "correspondencepostAddress1" VARCHAR2(100) PATH 'soleCorrespondenceSection/postAddress1/asCurrent',
    "correspondencepostAddress2" VARCHAR2(100) PATH 'soleCorrespondenceSection/postAddress2/asCurrent',
    "correspondencepostAddress3" VARCHAR2(100) PATH 'soleCorrespondenceSection/postAddress3/asCurrent',
    "correspondencepostAddress4" VARCHAR2(100) PATH 'soleCorrespondenceSection/postAddress4/asCurrent',
    "correspondencepostCity" VARCHAR2(100) PATH 'soleCorrespondenceSection/postCity/asCurrent',
    "correspondencepostCountry" VARCHAR2(100) PATH 'soleCorrespondenceSection/postCountry/asCurrent',
    "correspondencepostCounty" VARCHAR2(100) PATH 'soleCorrespondenceSection/postCounty/asCurrent',
    "correspondencepostNum" VARCHAR2(100) PATH 'soleCorrespondenceSection/postNum/asCurrent',
    "correspondencepostPostal" VARCHAR2(100) PATH 'soleCorrespondenceSection/postPostal/asCurrent',
    "correspondencepostType" VARCHAR2(100) PATH 'soleCorrespondenceSection/postType/asCurrent',
    "soleidrescountryOfBirth" VARCHAR2(100) PATH 'soleIdResSection/countryOfBirth/asCurrent',
    "soleidrescountryOfCit" VARCHAR2(100) PATH 'soleIdResSection/countryOfCit/asCurrent',
    "soleidrescountryOfIssue" VARCHAR2(100) PATH 'soleIdResSection/countryOfIssue/asCurrent',
    "soleidrescountryOfRes" VARCHAR2(100) PATH 'soleIdResSection/countryOfRes/asCurrent',
    "soleidresdateOfBirth" DATE PATH 'soleIdResSection/dateOfBirth/asCurrent',
    "soleidresotherCountryOfIssue" VARCHAR2(100) PATH 'soleIdResSection/otherCountryOfIssue/asCurrent',
    "soleidresotherID" VARCHAR2(100) PATH 'soleIdResSection/otherID/asCurrent',
    "soleidresotherIDNumber" VARCHAR2(100) PATH 'soleIdResSection/otherIDNumber/asCurrent',
    "soleidrespassportExpiryDate" DATE PATH 'soleIdResSection/passportExpiryDate/asCurrent',
        "soleidrespassportNum" VARCHAR2(100) PATH 'soleIdResSection/passportNum/asCurrent',
    "condMarriage" VARCHAR2(100) PATH 'soleMiscSection/condMarriage/asCurrent',
    "employer" VARCHAR2(100) PATH 'soleMiscSection/employer/asCurrent',
    "maritalStatus" VARCHAR2(100) PATH 'soleMiscSection/maritalStatus/asCurrent',
    "spouseMaiden" VARCHAR2(100) PATH 'soleMiscSection/spouseMaiden/asCurrent',
    "spouseName" VARCHAR2(100) PATH 'soleMiscSection/spouseName/asCurrent',
    "spousePerID" VARCHAR2(100) PATH 'soleMiscSection/spousePerID/asCurrent',
    "spouseTIN" VARCHAR2(100) PATH 'soleMiscSection/spouseTIN/asCurrent',
        "vatPreviousName"   VARCHAR2(100)   PATH    'vatPreviousSection/vatPreviousName/asCurrent',
    "vatPreviousTIN"    VARCHAR2(100)   PATH    'vatPreviousSection/vatPreviousTIN/asCurrent',
    "vatPerID"  VARCHAR2(100)   PATH    'vatPreviousSection/vatPerID/asCurrent',
    "vatPreviousAddress"    VARCHAR2(100)   PATH    'vatPreviousSection/vatPreviousAddress/asCurrent')


   L2_CI_REG_FORM_REGISTRATION,





      XMLTable(
      'for $i in REGISTRATION/fbtSection/fbtDetails/fbtDetailsList/fbtType
       return <row> 
       {
        $i
       } 
       </row>' 
      PASSING xmltype(L1_CI_REG_FORM.BO_DATA_AREA) 
      COLUMNS "fbtType"    VARCHAR2(100)  PATH 'fbtType/asCurrent'
     )

  L2_CI_REG_FORM_FBT,




       XMLTable(
      'for $i in REGISTRATION/whtSection/whtTypeDetails/whtTypeDetailsList/whtType
       return <row> 
       {
        $i,
        $i/following-sibling::whtOther[1]
       } 
       </row>' 
      PASSING xmltype(L1_CI_REG_FORM.BO_DATA_AREA) 
      COLUMNS    

      "whtType" varchar2(16) PATH 'whtType/asCurrent',
      "whtOther" varchar2(100) PATH 'whtOther/asCurrent')

        L2_CI_REG_FORM_WITHB,



        XMLTable(
      'for $i in REGISTRATION/directorSection/directorGroup/directorGroupList/directorName
       return <row> 
       {
        $i,
        $i/following-sibling::directorPerID[1],
        $i/following-sibling::directorTIN[1]
       } 
       </row>' 
      PASSING xmltype(L1_CI_REG_FORM.BO_DATA_AREA) 
      COLUMNS    

      "directorName" varchar2(16) PATH 'directorName/asCurrent',
      "directorPerID" varchar2(100) PATH 'directorPerID/asCurrent',
      "directorTIN" varchar2(100) PATH 'directorTIN/asCurrent')

   L2_CI_REG_FORM_DIRECTOR,



        XMLTable(
      'for $i in REGISTRATION/tradenameSection/tradeNameDetails/tradeNameDetailsList/tradeName
       return <row> 
       {
        $i,
        $i/following-sibling::commencementDate[1],
        $i/following-sibling::natureOfBusiness[1],
        $i/following-sibling::traderNumber[1]
       } 
       </row>' 
      PASSING xmltype(L1_CI_REG_FORM.BO_DATA_AREA) 
      COLUMNS    
    "tradeName" VARCHAR2(100)   PATH    'tradeName/asCurrent',
    "commencementDate"  DATE    PATH    'commencementDate/asCurrent',
    "natureOfBusiness"  VARCHAR2(100)   PATH    'natureOfBusiness/asCurrent',
    "traderNumber"  VARCHAR2(100)   PATH    'traderNumber/asCurrent')

   L2_CI_REG_FORM_TRADENAME


WHERE (1=1)  AND TRIM(FORM_TYPE_CD) = 'BUSREGFORM' AND STATUS_UPD_DTTM < '1/SEP/13'
; 

1 个答案:

答案 0 :(得分:0)

您可以将select语句实现为带有&#34; bulk_collect&#34;的游标。阅读,为了一次只处理一小部分有限数量的行而不是一次处理查询的全部结果,寻求减少资源密集。

除此之外,考虑到使用索引的列上的函数排除索引(TRIM(FORM_TYPE_CD)),我不知道此列(FORM_TYPE_CD)是否有索引,I&#39 ;我只是指出它,所以你要确保它不会影响你的过程。