从XML文件中读取数据

时间:2011-06-28 10:59:34

标签: sql oracle plsql

我有一个包含XML数据的列(CLOB数据类型)。如何从该列读取数据并插入myTable?此XML表示一个报告除以位置。每个位置都有分析数据和总数。

如何获得这样的内容:

bilbo bagins Total BBB (tran: 6) 12.00 13.00 14.10
bilbo bagins Total EEE (tran: 2) 12.50 44.59 72.52
bilbo bagins Total bilbo bagins (tran: 8) 34.89 17.85
...

CLOB专栏中的数据:

<?xml version="1.0" encoding="UTF-8" ?>
<CrystalReport xmlns="urn:crystal-reports:schemas:report-detail"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:crystal-reports:schemas:report-detail http://www.businessobjects.com/products/xml/CR2008Schema.xsd">
<ReportHeader>
<Section SectionNumber="0">
</Section>
</ReportHeader>
<Group Level="1">
<GroupHeader>
<Section SectionNumber="0">
<Field Name="GroupNameLocation1" FieldName="GroupName ({SubAgentSettlement.Location})"><FormattedValue>bilbo bagins</FormattedValue><Value>bilbo bagins</Value></Field>
</Section>
</GroupHeader>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total BBB (tran: 6)</FormattedValue><Value>Total BBB (tran: 6)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>12.00</FormattedValue><Value>12.00</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>13.00</FormattedValue><Value>13.00</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>14.10</FormattedValue><Value>14.10</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total EEE (tran: 2)</FormattedValue><Value>Total EEE (tran: 2)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>12.50</FormattedValue><Value>12.50</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>44.59</FormattedValue><Value>44.59</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>72.52</FormattedValue><Value>72.52</Value></Field>
</Section>
</GroupFooter>
</Group>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="LocationGroupFooterText1" FieldName="{@LocationGroupFooterText}"><FormattedValue>Total bilbo bagins (tran: 8)</FormattedValue><Value>Total bilbo bagins (tran: 8)</Value></Field>
<Field Name="SumofCommissionBbb2" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Location})"><FormattedValue>34.89</FormattedValue><Value>34.89</Value></Field>
<Field Name="SumofCommissionEee2" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Location})"><FormattedValue>17.85</FormattedValue><Value>17.85</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="1">
<GroupHeader>
<Section SectionNumber="0">
<Field Name="GroupNameLocation1" FieldName="GroupName ({SubAgentSettlement.Location})"><FormattedValue>Bruce Lee</FormattedValue><Value>Bruce Lee</Value></Field>
</Section>
</GroupHeader>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total BBB (tran: 5)</FormattedValue><Value>Total BBB (tran: 5)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>18.11</FormattedValue><Value>18.11</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>3.24</FormattedValue><Value>3.24</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>1.33</FormattedValue><Value>1.33</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total EEE (tran: 8)</FormattedValue><Value>Total EEE (tran: 8)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>10.17</FormattedValue><Value>10.17</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>7.62</FormattedValue><Value>7.62</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>1.53</FormattedValue><Value>1.53</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total UUU (transactions: 7)</FormattedValue><Value>Total UUU (transactions: 7)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>2.01</FormattedValue><Value>2.01</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>3.71</FormattedValue><Value>3.71</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>2.58</FormattedValue><Value>2.58</Value></Field>
</Section>
</GroupFooter>
</Group>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="LocationGroupFooterText1" FieldName="{@LocationGroupFooterText}"><FormattedValue>Total Bruce Lee (tran: 60)</FormattedValue><Value>Total Bruce Lee (tran: 60)</Value></Field>
<Field Name="SumofCommissionBbb2" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Location})"><FormattedValue>99.74</FormattedValue><Value>99.74</Value></Field>
<Field Name="SumofCommissionEee2" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Location})"><FormattedValue>55.81</FormattedValue><Value>55.81</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="1">
<GroupHeader>
<Section SectionNumber="0">
<Field Name="GroupNameLocation1" FieldName="GroupName ({SubAgentSettlement.Location})"><FormattedValue>Katar pipin</FormattedValue><Value>Katar pipin</Value></Field>
</Section>
</GroupHeader>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total BBB (tran: 5)</FormattedValue><Value>Total BBB (tran: 5)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>7.00</FormattedValue><Value>7.00</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>7.00</FormattedValue><Value>7.00</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>3.82</FormattedValue><Value>3.82</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total EEE (tran: 3)</FormattedValue><Value>Total EEE (tran: 3)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>65.50</FormattedValue><Value>65.50</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>1.75</FormattedValue><Value>1.75</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>55.50</FormattedValue><Value>55.50</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total UUU (tran: 1)</FormattedValue><Value>Total UUU (tran: 1)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>1.00</FormattedValue><Value>1.00</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>17.35</FormattedValue><Value>17.35</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>10.69</FormattedValue><Value>10.69</Value></Field>
</Section>
</GroupFooter>
</Group>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="LocationGroupFooterText1" FieldName="{@LocationGroupFooterText}"><FormattedValue>Total Katar pipin (tran: 9)</FormattedValue><Value>Total Katar pipin (tran: 9)</Value></Field>
<Field Name="SumofCommissionBbb2" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Location})"><FormattedValue>9.10</FormattedValue><Value>9.10</Value></Field>
<Field Name="SumofCommissionEee2" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Location})"><FormattedValue>2.01</FormattedValue><Value>2.01</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="1">
<GroupHeader>
<Section SectionNumber="0">
<Field Name="GroupNameLocation1" FieldName="GroupName ({SubAgentSettlement.Location})"><FormattedValue>Samsung</FormattedValue><Value>Samsung</Value></Field>
</Section>
</GroupHeader>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total BBB (tran: 5)</FormattedValue><Value>Total BBB (tran: 5)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>16.00</FormattedValue><Value>16.00</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>17.00</FormattedValue><Value>17.00</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>17.46</FormattedValue><Value>17.46</Value></Field>
</Section>
</GroupFooter>
</Group>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="LocationGroupFooterText1" FieldName="{@LocationGroupFooterText}"><FormattedValue>Total Samsung (tran: 15)</FormattedValue><Value>Total Samsung (tran: 5)</Value></Field>
<Field Name="SumofCommissionBbb2" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Location})"><FormattedValue>5.00</FormattedValue><Value>5.00</Value></Field>
<Field Name="SumofCommissionEee2" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Location})"><FormattedValue>17.46</FormattedValue><Value>17.46</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="1">
<GroupHeader>
<Section SectionNumber="0">
<Field Name="GroupNameLocation1" FieldName="GroupName ({SubAgentSettlement.Location})"><FormattedValue>Erica</FormattedValue><Value>Erica</Value></Field>
</Section>
</GroupHeader>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total BBB (tran: 5)</FormattedValue><Value>Total BBB (tran: 5)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>6.10</FormattedValue><Value>6.10</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>6.12</FormattedValue><Value>6.12</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>88.08</FormattedValue><Value>88.08</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total EEE (tran: 2)</FormattedValue><Value>Total EEE (tran: 2)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>13.00</FormattedValue><Value>13.00</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>15.87</FormattedValue><Value>15.87</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>13.00</FormattedValue><Value>13.00</Value></Field>
</Section>
</GroupFooter>
</Group>
<Group Level="2">
<GroupHeader>
<Section SectionNumber="0">
</Section>
</GroupHeader>
<Details Level="3">
<Section SectionNumber="0">
</Section>
</Details>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="GroupFooterText1" FieldName="{@GroupFooterText}"><FormattedValue>Total UUU (transactions: 1)</FormattedValue><Value>Total UUU (transactions: 1)</Value></Field>
<Field Name="SumofCommission1" FieldName="Sum ({SubAgentSettlement.Commission}, {SubAgentSettlement.Currency})"><FormattedValue>22.00</FormattedValue><Value>22.00</Value></Field>
<Field Name="SumofCommissionBbb1" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Currency})"><FormattedValue>32.70</FormattedValue><Value>32.70</Value></Field>
<Field Name="SumofCommissionEee1" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Currency})"><FormattedValue>41.38</FormattedValue><Value>41.38</Value></Field>
</Section>
</GroupFooter>
</Group>
<GroupFooter>
<Section SectionNumber="0">
<Field Name="LocationGroupFooterText1" FieldName="{@LocationGroupFooterText}"><FormattedValue>Total Erica (tran: 8)</FormattedValue><Value>Total Erica (tran: 8)</Value></Field>
<Field Name="SumofCommissionBbb2" FieldName="Sum ({SubAgentSettlement.CommissionBBB}, {SubAgentSettlement.Location})"><FormattedValue>4.87</FormattedValue><Value>4.87</Value></Field>
<Field Name="SumofCommissionEee2" FieldName="Sum ({SubAgentSettlement.CommissionEEE}, {SubAgentSettlement.Location})"><FormattedValue>2.66</FormattedValue><Value>2.66</Value></Field>
</Section>
</GroupFooter>
</Group>
<ReportFooter>
<Section SectionNumber="0">
<Text Name="Text11"><TextValue>Total num of tran:</TextValue>
</Text>
<Field Name="CountofDate1" FieldName="Count ({SubAgentSettlement.Date})"><FormattedValue>126</FormattedValue><Value>126</Value></Field>
<Field Name="CurrencyRateLine1" FieldName="{@CurrencyRateLine}"><FormattedValue>Curr on date: 12/03/2009</FormattedValue><Value>Curr on date: 12/03/2009</Value></Field>
<Subreport Name="Subreport1">
<ReportHeader>
</ReportHeader>
<Details Level="1">
<Section SectionNumber="0">
<Field Name="CurrencyLine1" FieldName="{@CurrencyLine}"><FormattedValue>1 EEE = 10.12345 UUU</FormattedValue><Value>1 EEE = 10.12345 UUU</Value></Field>
</Section>
</Details>
<Details Level="1">
<Section SectionNumber="0">
<Field Name="CurrencyLine1" FieldName="{@CurrencyLine}"><FormattedValue>1 EEE = 7.12345 BBB</FormattedValue><Value>1 EEE = 7.12345 BBB</Value></Field>
</Section>
</Details>
<Details Level="1">
<Section SectionNumber="0">
<Field Name="CurrencyLine1" FieldName="{@CurrencyLine}"><FormattedValue>1 UUU = 6.12345 BBB</FormattedValue><Value>1 UUU = 6.123456 BBB</Value></Field>
</Section>
</Details>
<ReportFooter>
<Section SectionNumber="0">
</Section>
</ReportFooter>
</Subreport>
</Section>
<Section SectionNumber="1">
</Section>
</ReportFooter>
</CrystalReport>

2 个答案:

答案 0 :(得分:2)

在Oracle中最简单的方法是使用XMLTYPE,它允许您使用XPATH表达式访问XML字符串。我将举一个小例子,但您应该能够根据自己的XML进行调整:

declare
  v_xmlstring clob := '<myxml><field1>value1</field1></myxml>';
  v_xml xmltype;
begin
  v_xml := xmltype.createxml(v_xmlstring);
  dbms_output.put_line(v_xml.extract('/myxml/field1/text()').getstringval());
end;
/

这将打印value1。

给定字符串或clob,您可以使用xmltype.createxml()方法创建XMLTYPE。

然后您的任务将从XML中提取各种值。您可以使用XPATH表达式执行此操作,但这是一个两阶段过程。当你在XMLType上调用extract()它返回另一个XMLType - 要获取它的文本值,你在XMLType上调用getstringval(),这就是我在下面所做的。

现在你还有一个问题,因为你的XML文档有一个重复的部分,并且你想从每个部分得到一组值 - 你通过循环遍历xml来实现这一点 - 类似下面的代码就行了(记得xpath索引从1开始,而不像大多数数组那样为零!):

declare
  v_xmlstring clob := '<myxml>
                         <field1>value1</field1>
                         <field1>value2</field1>
                         <field1>value3</field1>
                       </myxml>';
  v_xml xmltype;
  v_count integer := 1;
begin
  v_xml := xmltype.createxml(v_xmlstring);
  while v_xml.existsNode('/myxml/field1['||v_count||']') = 1 loop
    dbms_output.put_line(v_xml.extract('/myxml/field1['||v_count||']/text()').getStringVal());
    v_count := v_count + 1;
  end loop;
end;

/

答案 1 :(得分:0)

看看this ..

在使用Sys.XMLType.createXML()

传递给proc之前,您可能需要将clob转换为XMLType。