Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Procedure to load data from XML to Oracle

3802575Sep 30 2018 — edited Oct 4 2018

Hi All,

I am newbie to Oracle world. I am working on Oracle 12C. Can any one please suggest to load the data from XML to Oracle table. Have seen many threads but all are on EMP table. Can any one share me your knowledge, I have sentive data in XML so unable to post here.

create table XML_data

(

XML_TAB    XMLTYPE

);

1. Is it possible to load XML data to Oracle table without creating a Directory?

     Googled,  it is possible with SQL Loader. But I couldn't find how can we execute from Toad/SQL Develoer ( I don't have SQL plus to run the control file from Command prompt. )

can you give an example without creating a directory how can we insert the data.

2. I vae list of columns with mapped but I am not clear

Have table as below.

create table SPRINGS

(

ID number  --PK

spring_no   varchar2(30),   --Unique

min_x  number,  --//springsst/area[@shape='rect']/@coords.   Format is upper-left X, Y, lower-right X,Y.  Corrdinates are from the upper-right corner.

max_x number,--//springsst/area[@shape='rect']/@coords.   Format is upper-left X, Y, lower-right X,Y.  Corrdinates are from the upper-right corner.

Min_Y  number, --//springsst/area[@shape='rect']/@coords.   Format is upper-left X, Y, lower-right X,Y.  Corrdinates are from the upper-right corner.

max_y number  --//springsst/area[@shape='rect']/@coords.   Format is upper-left X, Y, lower-right X,Y.  Corrdinates are from the upper-right corner.

);

please advise how to define the paths while passing COLUMNS in XML type for "--//springsst/area[@shape='rect']/@cords"..Would be great if any one can give me the query to pass

I am trying to write SELECT query as below , but am not getting how to define the paths for different X and Y.

select x.*  

from XML_data tab 

   , xmltable( 

        
' path how can we define here'

          passing tab.xml_tab

          columns           

min_x  number,  --//springsst/area[@shape='rect']/@coords.   Format is upper-left X, Y, lower-right X,Y.  Corrdinates are from the upper-right corner.

max_x number,--//springsst/area[@shape='rect']/@coords.   Format is upper-left X, Y, lower-right X,Y.  Corrdinates are from the upper-right corner.

Min_Y  number, --//springsst/area[@shape='rect']/@coords.   Format is upper-left X, Y, lower-right X,Y.  Corrdinates are from the upper-right corner.

max_y number  --//springsst/area[@shape='rect']/@coords.   Format is upper-left X, Y, lower-right X,Y.  Corrdinates are from the upper-right corner.

)  

     ) x ;

Thanks

Kris

This post has been answered by mNem on Oct 3 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 1 2018
Added on Sep 30 2018
53 comments
1,697 views