Oracle XML : Skip Not exist Node

后端 未结 2 2027
[愿得一人]
[愿得一人] 2021-01-17 03:40

I have a problem proceed xml data to insert in oracle table, here is my xml :


    
        gordon         


        
2条回答
  •  没有蜡笔的小新
    2021-01-17 04:10

    You didn't say how you've tried to parsexml. Here is an example with XMLTABLE that gives you the excepted results:

    with xmldata(d) as (select xmltype('
        
            gordon
            
                100
                
                     213
                
            
            
    Jl. jalan pelan-pelan ke Bekasi, Indonesia
    mark
    Jl. jalan cepet-cepet ke Jakarta, Indonesia
    ') from dual ) select x.* from xmldata, xmltable('begin/entry' passing xmldata.d columns last_name varchar2(10) path 'lastname', number_ number path 'NumberList/number', code number path 'NumberList/codelist/code', address varchar2(50) path 'address/addresslist' ) x ;

    Results:

    LAST_NAME  NUMBER_  CODE ADDRESS
    ---------- ------- ----- --------------------------------------------------
    gordon         100   213 Jl. jalan pelan-pelan ke Bekasi, Indonesia
    mark                     Jl. jalan cepet-cepet ke Jakarta, Indonesia
    

    Hope this helps !

提交回复
热议问题