我正在嘗試創建一個用列與xml文件分隔的oracle表。 我使用的SQL命令以創建表:基於XML文件創建Oracle表
create table mytable of XMLType;
insert into mytable2 values(XMLType(bfilename('XMLDIR','XMLFileName.xml'),nls_charset_id('AL32UTF8')));
文件被插入到一個XML結構的表,但我需要查看在列或僅選擇字段到令牌克拉後標記: IID。 例如,在第一個標籤中,我需要選擇值「OrphanedBSCs」。
<?xml version="1.0" encoding="WINDOWS-1252"?>
<ArrayOfRootEntityType xmlns:umts="http://www.aircominternational.com/Schemas/UMTS/2010/07" xmlns:tra70="http://www.aircominternational.com/Schemas/Connect/2010/08" xmlns:ct="http://www.aircominternational.com/Schemas/CommonTypes/2009/05" xmlns:co="http://www.aircominternational.com/Schemas/Common/2009/07" xmlns:gsm80="http://www.aircominternational.com/Schemas/GSM/2011/04" xmlns:ecs="http://www.aircominternational.com/Schemas/EWS/ECSCoverageTypes/2011/08" xmlns:gsm70="http://www.aircominternational.com/Schemas/GSM/2010/08" xmlns:config="http://www.aircominternational.com/Schemas/Configuration/2010/08" xmlns:cdma="http://www.aircominternational.com/Schemas/CDMA/2010/12" xmlns:co70="http://www.aircominternational.com/Schemas/Common/2010/08" xmlns:umts80="http://www.aircominternational.com/Schemas/UMTS/2011/04" xmlns:eqp70="http://www.aircominternational.com/Schemas/Equipment/2010/08" xmlns:co80="http://www.aircominternational.com/Schemas/Common/2011/04" xmlns:util="http://www.aircominternational.com/contract/Util/2009/10" xmlns:tra80="http://www.aircominternational.com/Schemas/Connect/2011/04" xmlns:umts70="http://www.aircominternational.com/Schemas/UMTS/2010/08" xmlns:eqp80="http://www.aircominternational.com/Schemas/Equipment/2011/04" xmlns:tra="http://www.aircominternational.com/Schemas/Connect/2009/09" xmlns:lte="http://www.aircominternational.com/Schemas/LTE/2010/08" xmlns:eds="http://www.aircominternational.com/contract/EDS/2009/05" xmlns:umts2="http://www.aircominternational.com/Schemas/UMTS/2009/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:eqp="http://www.aircominternational.com/Schemas/Equipment/2009/09" xmlns:gsm="http://www.aircominternational.com/Schemas/GSM/2009/09" xmlns:lte80="http://www.aircominternational.com/Schemas/LTE/2011/04">
<RootEntityType xsi:type="gsm:MSCType" ct:iid="OrphanedBSCs" ct:bvid="IVLP_201303" ct:eid="223127">
<Security>
<CreateDate>2013-03-21T10:01:18</CreateDate>
<ModifyDate>2013-03-21T10:01:19</ModifyDate>
<CreateUser>EDS_SOA_Client</CreateUser>
<ModifyUser>EDS_SOA_Client</ModifyUser>
<UserGroup>All</UserGroup>
<Permissions>
<Owner>write</Owner>
<Group>write</Group>
<All>read</All>
</Permissions>
</Security>
<CustomFields>
<Field Group="SOURCE" Value="NETWORK"/>
<Field Group="LastUpdated" Value="3/21/2013 10:01:18 AM"/>
</CustomFields>
<Location ct:iid="OrphanedBSCs_msc_loc" ct:eid="119692"/>
<gsm:BSCs>
<gsm:BSC ct:iid="OrphanedSites" ct:bvid="IVLP_201303" ct:eid="223128">
<Security>
<CreateDate>2013-03-21T10:01:19</CreateDate>
<ModifyDate>2013-03-21T10:01:19</ModifyDate>
<CreateUser>EDS_SOA_Client</CreateUser>
<ModifyUser>EDS_SOA_Client</ModifyUser>
<UserGroup>All</UserGroup>
<Permissions>
<Owner>write</Owner>
<Group>write</Group>
<All>read</All>
</Permissions>
</Security>
<CustomFields>
<Field Group="SOURCE" Value="NETWORK"/>
<Field Group="LastUpdated" Value="3/21/2013 10:01:19 AM"/>
</CustomFields>
<Location ct:iid="OrphanedSites_bsc_loc" ct:eid="119693"/>
<gsm:Parent ct:iid="OrphanedBSCs" ct:eid="223127"/>
<gsm:BSCId>0</gsm:BSCId>
<gsm:AllowedOperations>ReadWrite</gsm:AllowedOperations>
</gsm:BSC>
</gsm:BSCs>
<gsm:AllowedOperations>ReadWrite</gsm:AllowedOperations>
</RootEntityType>
<RootEntityType xsi:type="gsm:MSCType" ct:iid="HUAWEI_2G_MSC" ct:bvid="IVLP_201303" ct:eid="223131">
<Security>
<CreateDate>2013-03-21T10:01:21</CreateDate>
<ModifyDate>2013-03-21T10:01:21</ModifyDate>
<CreateUser>EDS_SOA_Client</CreateUser>
<ModifyUser>EDS_SOA_Client</ModifyUser>
<UserGroup>All</UserGroup>
<Permissions>
<Owner>write</Owner>
<Group>write</Group>
<All>read</All>
</Permissions>
</Security>
<CustomFields>
<Field Group="SOURCE" Value="NETWORK"/>
<Field Group="LastUpdated" Value="3/21/2013 10:01:21 AM"/>
</CustomFields>
<Location ct:iid="HUAWEI_2G_MSC_msc_loc" ct:eid="119696"/>
<gsm:BSCs>
<gsm:BSC ct:iid="BSCMG35" ct:bvid="IVLP_201303" ct:eid="223252">
<Security>
<CreateDate>2013-03-21T10:01:30</CreateDate>
<ModifyDate>2013-03-21T10:01:30</ModifyDate>
<CreateUser>EDS_SOA_Client</CreateUser>
<ModifyUser>EDS_SOA_Client</ModifyUser>
<UserGroup>All</UserGroup>
<Permissions>
<Owner>write</Owner>
<Group>write</Group>
<All>read</All>
</Permissions>
</Security>
<CustomFields>
<Field Group="SOURCE" Value="NETWORK"/>
<Field Group="LastUpdated" Value="3/21/2013 10:01:22 AM"/>
</CustomFields>
<Location ct:iid="BSCMG35_bsc_loc" ct:eid="119817"/>
<gsm:Parent ct:iid="HUAWEI_2G_MSC" ct:eid="223131"/>
<gsm:BSCId>0</gsm:BSCId>
<gsm:AllowedOperations>ReadWrite</gsm:AllowedOperations>
</gsm:BSC>
<gsm:BSC ct:iid="BSCMG34" ct:bvid="IVLP_201303" ct:eid="223270">
<Security>
<CreateDate>2013-03-21T10:01:30</CreateDate>
<ModifyDate>2013-03-21T10:01:30</ModifyDate>
<CreateUser>EDS_SOA_Client</CreateUser>
<ModifyUser>EDS_SOA_Client</ModifyUser>
<UserGroup>All</UserGroup>
<Permissions>
<Owner>write</Owner>
<Group>write</Group>
<All>read</All>
</Permissions>
</Security>
<CustomFields>
<Field Group="SOURCE" Value="NETWORK"/>
<Field Group="LastUpdated" Value="3/21/2013 10:01:22 AM"/>
</CustomFields>
<Location ct:iid="BSCMG34_bsc_loc" ct:eid="119835"/>
<gsm:Parent ct:iid="HUAWEI_2G_MSC" ct:eid="223131"/>
<gsm:BSCId>0</gsm:BSCId>
<gsm:AllowedOperations>ReadWrite</gsm:AllowedOperations>
</gsm:BSC>
</gsm:BSCs>
<gsm:AllowedOperations>ReadWrite</gsm:AllowedOperations>
</RootEntityType>
</ArrayOfRootEntityType>
有幾種方法可以實現這一點,你可以在XML數據上創建一個視圖,或者創建一個包含所需列的表格,然後僅使用所需元素進行插入/選擇。我強烈建議您閱讀Oracle Docs,因爲它們相當不錯 - http://docs.oracle.com/cd/E11882_01/appdev.112/e16659/toc.htm – OldProgrammer