Inserting XML into Oracle Table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sainiamit25
    New Member
    • Jul 2007
    • 40

    Inserting XML into Oracle Table

    Hi All,

    I want to pick one xml file from a location and insert it into a coulmn in the database (CLOB). Can you please let me know how can i do that? Steps should be:-

    (1) There is a file A.xml in a location.
    (2) My code runs and puts the file in the table column.
    eg if i select data from this coulmn, i should get the something like this:-
    <?xml version="1.0" encoding="UTF-8"?>
    <Location>
    <country>Chin a</country>
    </Location>

    An early response would be highly appreciated..

    Regards,
    Amit
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    what is the problem ?

    are you unable to store and retrive data into CLOB field ?

    Comment

    • sainiamit25
      New Member
      • Jul 2007
      • 40

      #3
      Originally posted by debasisdas
      what is the problem ?

      are you unable to store and retrive data into CLOB field ?
      Hi,

      i don't know how to do that. Can you please send me a sample code for doing that?

      Regards,
      Amit

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        please find related discussions here , here and here.

        Comment

        • sainiamit25
          New Member
          • Jul 2007
          • 40

          #5
          Originally posted by debasisdas
          please find related discussions here , here and here.
          Hi,

          Thanks for the help. I was able to insert xml as clob in one of my tables. So now my code works perfectly when i have one file in teh specific directory. But now the requirement is :-

          (1) I have one logical directory.
          (2) There i have 10 or 15 files with any arbitary name.
          (3) My code should pick them one by one and insert them into database.

          There is no limit on the number of files or their naming. I know i can use something like EOF for a file or some dbms_lob function, but i have not been to find anything for the directory. I need something like select file_name from direcctory which i can use in my cursor loop and it should traverse each file and correspondingly insert that into database.

          Thanks in advance your response.

          Best Regards,
          Amit

          Comment

          Working...