Bulk Inserts

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kiran Dalvi

    Bulk Inserts

    Hi,

    I have following problem scenario .....

    I have a XML of the format ....
    <Data>
    <Employee>
    <EmpName>Kira n</EmpName>
    <EmpID>100</EmpID>
    </Employee>
    <Employee>
    <EmpName>Faheem </EmpName>
    <EmpID>1000</EmpID>
    </Employee>
    ..
    ..
    .. ..... I have such 30000+ blocks corressponding to 30000+
    Employees.
    </Data>

    Now, I have a DB design with following columns .....
    1) EmpName Varchar2(64)
    2) EmpID Number(64)


    Here I want to parse this XML and persist the data from that XML into
    DB "efficientl y".
    I don't want to use conventional INSERTs.

    How can I go about it ?

    Thanks,
    --Kiran
  • Christine

    #2
    Re: Bulk Inserts

    1.replace all the TAGs.
    ex) as you may know >sed -e "s/<Data>/--<Data>/" aaa.txt aaa.out

    replace <Data -> --<Data>
    replace </Data> -> --</Data>
    replace <Employee -> --<Employee>
    replace </Employee> -> --</Employee>
    replace <EmpName -> INSERT INTO EMPLOYEE(EmpNam e, EmpID) VALUES( '
    replace </EmpName - '
    replace <EmpID> - ,
    replace </EmpID> - );

    2.execute generated output file.

    output file will be like this,

    --<Data>
    --<Employee>
    INSERT INTO EMPLOYEE(EmpNam e, EmpID) VALUES( 'Kiran'
    ,100);
    --</Employee>


    Cheers,
    Christine.
    =============== =============== =============== =============== ====

    rayoflight_kira n@yahoo.com (Kiran Dalvi) wrote in message news:<b33f94a.0 312150302.1671a f2c@posting.goo gle.com>...
    Hi,
    >
    I have following problem scenario .....
    >
    I have a XML of the format ....
    <Data>
    <Employee>
    <EmpName>Kira n</EmpName>
    <EmpID>100</EmpID>
    </Employee>
    <Employee>
    <EmpName>Faheem </EmpName>
    <EmpID>1000</EmpID>
    </Employee>
    ..
    ..
    .. ..... I have such 30000+ blocks corressponding to 30000+
    Employees.
    </Data>
    >
    Now, I have a DB design with following columns .....
    1) EmpName Varchar2(64)
    2) EmpID Number(64)
    >
    >
    Here I want to parse this XML and persist the data from that XML into
    DB "efficientl y".
    I don't want to use conventional INSERTs.
    >
    How can I go about it ?
    >
    Thanks,
    --Kiran

    Comment

    Working...