Help needed to load XML into DB table

I need some serious help if someone can spare the time. I am completely new to XML and don't really understand it yet but I need to be able to load an XML file (example) below.
I want to load this into a table that would look like the following:
CHAPTER_TITLE    DOC_HTML    DOC_TITLE
Men's Health      494440          AAAAA
Men's Health      496812          BBBBB
etc....
<?xml version=1.0 encoding=utf-8?>
<BookCollections Quantity=1 Title=Emis Books Collection>
    <Book Folder=PILSS Title=Patient Support>
        <Chapter Title=Men''s Health>
            <Document DocHTML=494440 Title=AAAAA />
            <Document DocHTML=496812 Title=BBBBB />
            <Document DocHTML=498923 Title=CCCCC />
            <Document DocHTML=499844 Title=DDDDD />
            <Document DocHTML=499901 Title=EEEEE />
        </Chapter>
    </Book>
</BookCollections>I have read through the documentation I could find but I can't get it to work. I had a simple procedure which loaded the text file as a CLOB and then inserted it into an XMLTYPE column but even that wouldn't work. I would rather it loaded as above in seperate columns.
Is there a simple example someone can help me out with?

That is very close ORA_SID thank you. But I get the ORA-19025 error when I have more than one Chapter section. The example was a cut down version, ther real file has thousands of Chapters.
e.g.
  1  insert into test2 values(xmltype(' <BookCollections Quantity="1" Title="Emis Books Collection">
  2  <Book Folder="PILSS" Title="Patient Support">
  3  <Chapter Title="Men''s Health">
  4              <Document DocHTML="494440" Title="AAAAA" />
  5              <Document DocHTML="496812" Title="BBBBB" />
  6              <Document DocHTML="498923" Title="CCCCC" />
  7              <Document DocHTML="499844" Title="DDDDD" />
  8              <Document DocHTML="499901" Title="EEEEE" />
  9              <Document DocHTML="500381" Title="FFFFF" />
10              <Document DocHTML="500446" Title="GGGGG" />
11              <Document DocHTML="500996" Title="HHHHH" />
12          </Chapter>
13          <Chapter Title="Contraception">
14              <Document DocHTML="496815" Title="IIIII" />
15              <Document DocHTML="496817" Title="JJJJJ" />
16              <Document DocHTML="499547" Title="KKKKK" />
17              <Document DocHTML="499550" Title="LLLLL" />
18              <Document DocHTML="500473" Title="MMMMM" />
19              <Document DocHTML="500704" Title="NNNNN" />
20              <Document DocHTML="500813" Title="OOOOO" />
21              <Document DocHTML="500995" Title="PPPPP />
22              <Document DocHTML="500996" Title="QQQQQ" />
23          </Chapter>
24  </Book>
25  </BookCollections>
26* '))
SQL> /
1 row created.
SQL> SELECT extractValue(xml_data, '/BookCollections/Book/Chapter/@Title') AS Chapter_Title,
  2  extractValue(value(em), '/Document/@DocHTML') AS Document_DocHTML,
  3  extractValue(value(em), '/Document/@Title') AS Document_Title
  4  FROM test2,table(XMLSequence(extract(xml_data,'/BookCollections/Book/Chapter/Document'))) em
  5  ;
FROM test2,table(XMLSequence(extract(xml_data,'/BookCollections/Book/Chapter/Document'))) em
ERROR at line 4:
ORA-19025: EXTRACTVALUE returns value of only one nodeCan you help on this?

Similar Messages

  • How To Load XML into a Table

    Hello All,
    I need to load many XML files into their own tables without using the XMLType column type. We need each element/attribute to get it's own column. For example
    <book id="bk103">
    <genre>Mystery</genre>
    </book>
    should load to a table with columns ID, GENRE of type varchar2. I have 1000s of XML files that need to be loaded, each with different data/structure. Ideally, I want to be able to point a SP at a folder that contains, say 250 XML files, run it, then have it create 250 tables each with a column set corresponding to each element/attribute from the XML file. Given that each XML file has a different structure, I need a solution that does not require a table to already exist. A solution that figures it out on the fly, perhaps using the VARCHAR2 type for all columns, would be best. I did notice this post, but it first requires the table to already exist. Is there a way to load 1 or more XML files into their own table with non XMLType datatypes where each table is created on the fly?
    Any help appreciated,
    TIA
    Rob
    Edited by: user10729248 on Dec 19, 2008 6:13 AM
    Edited by: user10729248 on Dec 19, 2008 6:14 AM

    Thanks for the response but I am not finding the information helpful. The examples provided assume the table into which the XML file is loaded already exists or a CREATE TABLE script is run. I need a solution that creates the table automagically. Can someone provide an example of this please? Also, I'm looking for a PL/SQL SP-based solution if this is possible. Many of the examples use Java; we're using .NET.

  • Loading xml into relational tables.

    I was wondering if anyone knows of a product/libraries which does the following:
    -Read data from a relational Database (multiple tables) and generate XML files based upon an XML Schema or DTD file?
    -Read XML files and load data into a relational Database.
    -Graphical Interface for performing the maps (perhaps based upon .xslt). ie.... Mapping of the XML Schema to Multiple Database Tables, Performing Joins etc...
    -Ability to connect to any type of Relational database (not just Oracle). Which rules out XML DB.

    This product does look to be ok, however it is missing a couple features that I would like the product to have.
    I would like this product to be able to insert/update data across multiple tables. Being able to do such things as generate foreign key relationships.
    It doesn't seem as though the XML being generated can be customized very easily. Some XML formats I deal with are very complex (such as X12/EDI).
    I would really like a graphical mapper.
    Here is a note from the doc:
    Storing XML Data Across Tables
    Currently the XML SQL Utility (XSU) can only store data in a single table. It maps a canonical representation of an XML document into any table or view. But there is a way to store XML with XSU across tables. You can do this using XSLT to transform any document into multiple documents and insert them separately. Another way is to define views over multiple tables (using object views if needed) and then do the insertions into the view. If the view is inherently non-updatable (because of complex joins), then you can use INSTEAD OF triggers over the views to do the inserts.
    This product looks really good, I was hoping that Oracle had something comparable:
    http://www.hitsw.com/products_services/xml_platform/allora.html

  • Howto import XML into Excel table ?

    Hi,
    I asked this before in the Excel forums but received the suggestion that I ask here instead.  The question precis : How to ungrey the "Append new data to existing XML lists" checkbox so I can select it when importing XML data into an Excel
    spreadsheet.
    I have a local server which provides data in XML form and need to import successive reloads of the XML page into successive lines in an Excel spreadsheet.  I found the Excel help page entitled "How to use XML in Excel 2003" at http://office.microsoft.com/en-gb/excel-help/how-to-use-xml-in-excel-2003-HA001101964.aspx?CTT=1&origin=EC001022986
    which was useful in so far as permitting me to import the data using the XML Source task pane and mapping the elements I need from the XML source to columns in the spreadsheet.
    In order to append successive lines from the XML source page, as I understand it from the link I quoted,  I need to change the XML Map properties to "Append new data to existing XML lists".  However this checkbox is greyed out in the
    XML Map properties dialog box so I can't select it.
    Any ideas how I can achieve my aims here ?
    Thanks in advance,
    Mike

    Hi Mike,
    Thank you for contacting Office IT Pro General Discussions Services. 
    From your description, I understand that you tried to import XML into Excel table. You selected “Use the XML Source
    task pane” when opening the XML file, then you tried to check the option in the
    Map Properties window: "Append new data to existing XML lists". 
    However, this option is grayed out. If there is any misunderstanding, please feel free to let me know.
    I have checked the issue on my side but could not reproduce this issue. I suggest download the sample XML file as suggested on the page and test the
    issue again:
    http://www.microsoft.com/downloads/details.aspx?FamilyId=B4BD3283-AD0B-408D-9CE7-AB9C3537BBBB&displaylang=en
    If the problem does not occur with the sample XML file, this issue might occur as there are some problems with the XML you were using.
    If the problem also occurs in with the sample XML file, this issue might be related to some third-party software conflicts. I suggest checking this
    issue by starting Excel in the safe mode.
    Start the Office program in safe mode
    ==============
    1.      
    Click Start, point to All Programs, and then point to
    Microsoft Office.
    2.       
    Press and hold the CTRL key, and then click
    Microsoft Excel.
    If the problem does not occur in the safe mode, this issue might be related to some third-party add-ins in the Excel program, we can try to disable
    them. Normally, you could do the following to disable the conflict add-ins in your Excel program:
    Disable add-ins
    Click
    Tools > Options > 
    Add-in, click Go button in the Manage:
    Com-in Add.
    Check if there are any add-ins,
    clear the checkbox to disable them.
    Close the Office program and
    restart it.
    Add one check back each time to the list of Add-In,
    restart the Office program, and repeat the above procedure. Once the issue reappears again, we can determine which add-in causes this problem and then disable it.
    Please take your time to try the suggestions and let me know the results at your earliest convenience. If anything is unclear or if there is anything
    I can do for you, please feel free to let me know.
    Best Regards,
    Sally Tang

  • Loading data into a table

    I am loading data into a table I created which includes a column "Description" with a data type VARCHAR2(1000). When I go to load the data which is less than 1000 characters I receive the following error message:
    Record 38: Rejected - Error on table SSW_INPUTS, column DESCRIPTION.
    Field in data file exceeds maximum length
    I have increased the size of the column but that does not seem to fix the error. Does anyone know what this error means? Another thought is that I have created the "Description" column to large...which can't be true because I should receive the error when I create the table. Plus I already inputted data into a similar table with similar data and had no problems!
    Someone please help...
    Thank you,
    April.

    Note that I'm assuming Oracle8(i) behavior. Oracle9 may treat Unicode differently.
    Are you inserting Unicode data into the table? Declaring a variable as varchar2(1000) indicates that Oracle should reserve 1000 bytes for data. If you're inserting UTF-8 encoded data, each character may take up to 3 bytes to store. Thus, 334 characters of data could theoretically overflow a varchar2(1000) variable.
    Note that UTF-8 is designed so that the most commonly used characters are stored in 1 byte, less commonly used characters are stored in 2 bytes, and the remainder is stored in 3 bytes. On average, this will require less space than the more familiar UCS-2 encoding which stores every character as 2 bytes of data.
    Justin

  • Need to insert values into a table from a XML file

    Hi,
    I'm an Oracle 9i/10g DBA with quite a few years experience, but I'm new to XML and dealing with it in database terms. I've been given a project that entails pulling XML values out of a file (or 100's of them) and storing them in the database so that they are searchable by end-users. The project is classified as secret so I'm unable to upload the specific XML or any info relating to the structire of the XML or the table I will use to insert the values into - sorry!! So, I've created an XML file with a similar structure to help people understand my predicament.
    The end-users only need to search on a subset of the total amount of columns from the table I'll insert data into, although the XML file has a lot more, so I dont need to store the other values - but I will need to store the name of the XML file (or a pointer to it so I know what XML file a particular set of values belong to) in another column of the table along with its associated values.
    I've been using the XMLTABLE function with some degree of success, although I had better succes using the XMLSEQUENCE function. However, I found out this is deprecated in 10g and replaced with XMLTABLE, so I guess it's better if I use this in case we ever need to upgrade to 11g.
    The main problem I've been having is that some elements in the XML files have multiple values for the one record when all the other records are the same. In terms of storing this in the database, I guess it would mean inserting multiple rows in the table for each element where the value differs. Here is a dumbed down XML file similar to what I've got along with the other SQL I've used:
    +<?xml version="1.0" encoding="UTF-8"?>+
    +<House>+
    +<Warehouse>+
    +<WarehouseId>1</WarehouseId>+
    +<WarehouseName>+
    +<Town>Southlake</Town>+
    +<State>Texas</State>+
    +</WarehouseName>+
    +<Building>Owned</Building>+
    +<Area>25000</Area>+
    +<Docks>2</Docks>+
    +<DockType>Rear load</DockType>+
    +<WaterAccess>true</WaterAccess>+
    +<RailAccess>N</RailAccess>+
    +<Parking>Street</Parking>+
    +<VClearance>10</VClearance>+
    +</Warehouse>+
    +<Warehouse>+
    +<WarehouseId>2</WarehouseId>+
    +<WarehouseName>+
    +<Town>Poole</Town>+
    +<State>Dorset</State>+
    +</WarehouseName>+
    +<WarehouseName>+
    +<Town>Solihull</Town>+
    +<County>West Midlands</State>+
    +</WarehouseName>+
    +<Building>Owned</Building>+
    +<Area>40000</Area>+
    +<Docks>5</Docks>+
    +<DockType>Rear load</DockType>+
    +<WaterAccess>true</WaterAccess>+
    +<RailAccess>N</RailAccess>+
    +<Parking>Bay</Parking>+
    +<VClearance>10</VClearance>+
    +</Warehouse>+
    +<Warehouse>+
    +<WarehouseId>3</WarehouseId>+
    +<WarehouseName>+
    +<Town>Fleet</Town>+
    +<County>Hampshire</County>+
    +</WarehouseName>+
    +<Building>Owned</Building>+
    +<Area>10000</Area>+
    +<Docks>1</Docks>+
    +<DockType>Side load</DockType>+
    +<WaterAccess>false</WaterAccess>+
    +<RailAccess>N</RailAccess>+
    +<Parking>Bay</Parking>+
    +<VClearance>20</VClearance>+
    +</Warehouse>+
    +</House>+
    CREATE TABLE xmltest OF XMLTYPE;
    INSERT INTO xmltest
    VALUES(xmltype(bfilename('XML_DIR', 'test.xml'), nls_charset_id('AL32UTF8')));
    Consequently, I need to...
    1) Retrieve the results from the XML file for all 3 warehouses where multiple values for the same sub-element are shown as 2 rowsthe result set. (I am guessing there will be 4 rows returned as warehouse sub-2 has 2 different elements for <WarehouseName>.
    2) Build a case statement into the query so that regardless of the sub-element name (i.e State or County), it is returned into the 1 column, for instance County.
    So, if I run a query similar to the following...
    select y.WarehouseId, y.Town, y.County, y.Area
    from xmltest x, xmltable('/House/Warehouse' .......
    I would like to get results back like this...
    ID Town County Area
    1 Southlake Texas 25000
    2 Poole Dorset 40000
    2 Solihull West Midlands 40000
    3 Fleet hampshire 10000
    Sorry for the non-formatting but I hope this all makessense to someone out there with what I'm trying to do.
    I appreciate any help whatsoever because, as i said before, I'm totally new to XML and trying to read the vast amount of information there is out there on XML is all a bit daunting.
    Many thanks in advance,
    Shaun.

    Hi again,
    Thanks for keeping the post open for me. I've had a look at the post illustrating the XFileHandler package, and tried to alter it to make it fit with my XML files. To help explain things, my XML file looks like this:
    <?xml version="1.0"?>
    <!DOCTYPE  CMF_Doc SYSTEM "CMF_Doc.dtd">
    <House>
        <Warehouse>
        <WarehouseId>1</WarehouseId>
        <WarehouseName>
           <Town>Southlake</Town>
           <State>Texas</State>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>25000</Area>
        <Docks>2</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Street</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>House
        <WarehouseId>2</WarehouseId>
        <WarehouseName>
           <Town>Poole</Town>
           <State>Dorset</State>
        </WarehouseName>
        <WarehouseName>
           <Town>Solihull</Town>
           <County>West Midlands</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>40000</Area>
        <Docks>5</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>3</WarehouseId>
        <WarehouseName>
           <Town>Fleet</Town>
           <County>Hampshire</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>10000</Area>
        <Docks>1</Docks>
        <DockType>Side load</DockType>
        <WaterAccess>false</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>20</VClearance>
      </Warehouse>
    </House>
    <?xml version="1.0" encoding="UTF-8"?>
    <House>
        <Warehouse>
        <WarehouseId>4</WarehouseId>
        <WarehouseName>
           <Town>Dallas</Town>
           <State>Texas</State>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>25000</Area>
        <Docks>2</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Street</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>5</WarehouseId>
        <WarehouseName>
           <Town>Dorchester</Town>
           <State>Dorset</State>
        </WarehouseName>
        <WarehouseName>
           <Town>Solihull</Town>
           <County>West Midlands</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>40000</Area>
        <Docks>5</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>6</WarehouseId>
        <WarehouseName>
           <Town>Farnborough</Town>
           <County>Hampshire</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>10000</Area>
        <Docks>1</Docks>
        <DockType>Side load</DockType>
        <WaterAccess>false</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>20</VClearance>
      </Warehouse>
    </House>
    <?xml version="1.0" encoding="UTF-8"?>
    <House>
        <Warehouse>
        <WarehouseId>7</WarehouseId>
        <WarehouseName>
           <Town>Southlake</Town>
           <State>Texas</State>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>25000</Area>
        <Docks>2</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Street</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>8</WarehouseId>
        <WarehouseName>
           <Town>Bournemouth</Town>
           <State>Dorset</State>
        </WarehouseName>
        <WarehouseName>
           <Town>Shirley</Town>
           <County>West Midlands</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>30000</Area>
        <Docks>5</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>9</WarehouseId>
        <WarehouseName>
           <Town>Clapham</Town>
           <County>London</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>10000</Area>
        <Docks>1</Docks>
        <DockType>Side load</DockType>
        <WaterAccess>false</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>20</VClearance>
      </Warehouse>
    </House>And the XFilehandler package looks like this (I'm just trying to do a simple select only on WarehouseId & WaterAccess for the time being to keep things simple):
    create or replace package XFileHandler as
      TYPE TRECORD IS RECORD (
        WID     NUMBER(2)
      , WACCESS VARCHAR2(5)
      type TRecordTable is table of TRecord;
      function getRows (p_directory in varchar2, p_filename in varchar2) return TRecordTable pipelined;
    end;
    create or replace package body XFileHandler is
      function getRows (p_directory in varchar2, p_filename in varchar2)
       return TRecordTable pipelined
      is
        nb_rec          number := 1;
        tmp_xml        clob;
        tmp_file         clob;
        rec               TRecord;
      begin
        DBMS_LOB.CREATETEMPORARY(TMP_FILE, TRUE);
        tmp_file := dbms_xslprocessor.read2clob(p_directory, p_filename);
        LOOP
          tmp_xml := regexp_substr(tmp_file, '<\?xml[^?]+\?>\s*<([^>]+)>.*?</\1>', 1, nb_rec, 'n');
          exit when length(tmp_xml) = 0;
          --dbms_output.put_line(tmp_rec);
          nb_rec := nb_rec + 1;
        select y.WID, y.WACCESS
        into rec.WID, rec.WACCESS
        from xmltable('/House' passing xmltype(tmp_xml)
                      columns WID NUMBER(2) PATH 'Warehouse/WarehouseId',
                                  WACCESS VARCHAR2(5) PATH 'WaterAccess') y;
          pipe row ( rec );
        end loop;
        dbms_lob.freetemporary(tmp_file);
        return;
      end;
    end;Now, when I run the query:
    select * from table(XFileHandler.getRows('XML_DIR', 'XFileHandler_test.xml'));I get the error: ORA-00600: internal error code, arguments: [17285], [0x5CFE8DC8], [4], [0x45ABE1C8], [], [], [], []
    I had a look in the dump file for anything obvious, but nothing really stands out. Is there anything obvious in my code that I'm missing or something else which you may think could be causing this error, e.g in the regular expression regexp_substr?
    Many thanks,
    Shaun.

  • Help needed in Loading excel data to staging table from OAF Page

    Hi All,
    We have a requirement from the client on loading of a excel sheet data into staging table using OAF page.
    We were able to load a CSV file into staging table via OAF. The approach we used is we created a item of style 'messageFileUpload', which would pick the CSV file from desktop and we wrote the logic on the controller to place the file into server and then sumit a concurrent program to load the data into the staging table.
    But client wants data from the excel file to be loaded into staging table. Is there any way(approach) by which we can convert the excel file data into .CSV file using OAF?
    Any help or pointers on this will be highly apperciated.
    Thanks,
    Chethana

    Hi,
    Read through this :
    Need to upload a CSV/Excel to a table in OAF page
    Thanks,
    Gaurav

  • Need help in stroring CLOB data into a table

    Hi All,
    I have a CLOB data. Which contains delimited data.
    Example:
    "111#|#ABC#|#asfsdffgh $|$222#|#XYZ#|#jdsfgdskdsf $|$"
    #|# - is column delimiter.
    $|$ - is row delimiter
    I want to extract and store the above data into a table which has 3 columns. Need help.
    I have Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    Thanks in advance,
    Girish G

    Hi Girish,
    Please go through the below url's...It will give you fair idea and solution. HOpe you know the sql *loader utility. or external table.
    http://www.oracle-base.com/articles/10g/LoadLobDataUsingSqlLoader.php
    http://www.oracle-base.com/articles/10g/ExternalTablesContainingLobData.php
    KPR.

  • I need to load the reference/check table data in to MDM Server - help

    Hi,
      I need to load the referece table/check table data from ECC50 into FTP server/Ports. I am intrested only in Material and vendor extraction. Is this is possible with MDMGX or I need to use old zreports to extract reference table data? Any help on this is appreciated.
    Thanks,
    Daniel.LA

    Hi Daniel,
    U have to use generic extratctor MDMGX to extract reference data(customizing data) from R/3.
    Prerequisite:
    MDMGX to be installed.
    Procedure to use it.
    A)Setup Execution.
    1) Define Object type as per ur requirement (drop down list standard objects are provided like customer,vendor,products etc.).
    2)Define Repository and ftp server name.
    3)Upload ports and check table.
    4)Maintain ports and check table.
    B)Execute Generation and Extraction.
    1)Generate XSD.
    2) Starrt Execution.
    For each check table u have to create a separate port in MDM Repository.
    zreport is a older version ,it can be but neednot contain latest updates in check table .
    Reward Points if helpful.
    Regards,
    Neethu Joy.

  • Help needed to STOP xml loading

    Hi there,
    I'm pretty new to the action script side of things, have had some help on here already and have also been pulled up for asking for too much help.
    Well I'm kind of getting the hang of it now, but am having one major problem with the site I'm making, basically I've been following a tutorial for an xml based website, just about got my head round it but I need one line of code to stop the xml movie clip playing when I load a new one (eg when you navigate to a new page.
    this is the current code, if anyone can help I'd be massively thankful, this project has been doing my head in for weeks now - fingers crossed folks D
    // onLoad XML function
    function loadXML(success) {
    if (success) {
    // If the XML loads successfully, count how many projects there are in the file.
    _root.projectCount = this.firstChild.childNodes.length; // PROJECT node in XML file
    // Then run a function that builds arrays out of the XML data.
    SS_Arrays();
    } else {
    // If the xml data did not load, show message on stage by populating the description field.
    _root.description = "Error: Could not load XML";
    function SS_Arrays() {
    for (var count = 0; count < _root.projectCount; count++) {
    var nodeObj = objXML.firstChild.childNodes[count];
    namesArray[count] = nodeObj.attributes.name;
    descriptionsArray[count] = nodeObj.attributes.description;
    linksArray[count] = nodeObj.attributes.link;
    filesArray[count] = nodeObj.attributes.file;
    // run the function to create the thumbnail and list view buttons
    SS_createButtons();
    function SS_createButtons() {
    // First of all we want to hide the master button on the stage (btn_projects_main)
    // because we'll be making duplicates of it in the next part of the function
    _root.btn_projects_main._visible = 0;
    // Work out the X and Y positions of the main button so our new buttons start in the same place
    // (Which means where ever you position the main button is where the navigation will start).
    btn_xPos = _root.btn_projects_main._x;
    btn_yPos = _root.btn_projects_main._y;
    // Set the distances between your buttons and the number of rows
    btn_xDistance = 140;
    btn_yDistance = 19;
    btn_numOfRows = 5;
    // This figure is used to work out when to start a new column of buttons
    btn_yMax = btn_yPos + ((btn_numOfRows - 1) * btn_yDistance);
    // Loop through the projects array and create a button for each one by duplicating the original.
    for (count = 0; count < _root.projectCount; count++) {
    duplicateMovieClip(_root.btn_projects_main, "btn_projects" + count, count);
    // As the button is created, set it's X, Y & text properties
    _root["btn_projects" + count]._x = btn_xPos;
    _root["btn_projects" + count]._y = btn_yPos;
    _root["btn_projects" + count].text = namesArray[count];
    // set the X position for the next button
    if(btn_yPos == btn_yMax){
    // if the last buttons was the last row in the column (based on it's Y position) then start a new column
    // by resetting the Y position and adding 140px (btn_xDistance) to the the X position.
    btn_xPos = btn_xPos + btn_xDistance;
    btn_yPos = _root.btn_projects_main._y;
    } else {
    // if it's not the last one in a row, simply move it along the Y axis.
    btn_yPos = btn_yPos + btn_yDistance;
    // Load the first project (number 0) to avoid an empty screen
    SS_load_project(0);
    // Make the first project button highlighted
    tellTarget(_root.btn_projects0){
    gotoAndPlay(3);
    // Set the current button variable so we know which button to switch off when another one is pressed
    _root.curButton = "0";
    function SS_load_project(arrayNumber){

    Hi,
    In DBMS_JOBS_RUNNING you can find the sid of the session.
    Use this sid to identify the session in v$session and kill the session with:
    'alter system kill session 'sid,serial#';'
    Don't forget to mark the job as broken or remove it from the job queue.
    OR
    Before 10g, if you want to stop all jobs, you can simply set JOB_QUEUE_PROCESSES to zero.
    In 10g, Oracle intrduced scheduler_job with many advanced features.
    In this post I do not want to deal with different features of scheduler_jobs.
    In 10g, it is possible to schedule job either in dba_jobs or dba_scheduler_jobs.
    Setting JOB_QUEUE_PROCESSES to zero stops only jobs in dba_jobs which means that jobs in scheduler are still running .
    In order to disable jobs in dba_scheduler_job, the following script should be run for each job in scheduler.
    BEGIN
    sys.dbms_scheduler.disable( '"schema?"."job name?"' );
    END;
    Regards,
    Tom
    http://asktom.cz

  • Load XML into Table

    Hi All,
    I want to create a procedure in which , I provide table name and XML file location, The procedure goes at that location and pick XML file and load in to the table. Can this is possible ??
    Thanks
    Best Regards,
    Adil

    The following code very interesting.
    DROP TABLE TBL_TEST
    CREATE TABLE "TBL_TEST"
    (     "N" NUMBER,
    "V" VARCHAR2(20),
         "D" DATE)
    CREATE OR REPLACE DIRECTORY XML_DIR AS 'C:\XMLDIR';
    CREATE OR REPLACE
    PROCEDURE INSERT_XML_TBL_TEST(p_directory in varchar2,
    p_filename in varchar2)
    --p_tableName in varchar2 DEFAULT 'TBL_TEST')
    AS
    insCtx DBMS_XMLSTORE.CTXTYPE;
    rows NUMBER;
    xmlDoc CLOB := null;
    BEGIN
    if (dbms_xdb.existsResource('/public/'||lower(p_filename))) then
    dbms_xdb.deleteResource('/public/'||lower(p_filename));
    end if;
    v_return := DBMS_XDB.CREATERESOURCE(abspath => '/public/'||lower(p_filename),
    data => BFILENAME(UPPER(p_directory),LOWER(p_filename)));
    COMMIT;
    SELECT RV.RES.GETCLOBVAL()
    INTO xmldoc
    FROM RESOURCE_VIEW RV WHERE ANY_PATH = '/public/'||lower(p_filename);
    insCtx := DBMS_XMLSTORE.newcontext('TBL_TEST');
    dbms_xmlstore.SetRowTag(insctx,'TBL_TEST_ROW');
    dbms_xmlstore.clearkeycolumnlist(insctx);
    dbms_xmlstore.setupdatecolumn(insctx,'N');
    dbms_xmlstore.setupdatecolumn(insctx,'V');
    dbms_xmlstore.setupdatecolumn(insctx,'D');
    rows := dbms_xmlstore.insertxml(insctx, xmldoc);
    dbms_output.put_line(rows ||' rows inserted');
    dbms_xmlstore.closecontext(insctx);
    END;
    select * from tbl_test
    begin
    INSERT_XML_TBL_TEST('XML_DIR','tbl_test.xml');
    end;
    and I created XMLDIR folder on C:\
    and there have a xml file name is tbl_test.xml and content this file is
    <TBL_TEST_ROWSET>
    <TBL_TEST_ROW num="1">
    <N>11</N>
    <V>Testing 11</V>
    </TBL_TEST_ROW>
    <TBL_TEST_ROW num="2">
    <N>10</N>
    <V>Testing 11</V>
    </TBL_TEST_ROW>
    </TBL_TEST_ROWSET>
    Mahir M. Quluzade
    Edited by: Mahir M. Quluzade on Nov 24, 2010 11:47 AM

  • XML into a table??

    I am making an application that takes an XML file and puts the content into a table.
    I managed to parse the document with a SAX parser so far, but I am not sure how i can put the parsed results into the table, if anyone has done a similar thing, then please help. Some code examples will help a lot.
    it is a bit complicated as i will also need a table where its cells can span more than one column.
    Where do I begin?
    your help is greatly appreciated

    JTable? HTML table? Excel table? Something else?

  • Loading data into multiple tables using sqlloader

    Hi,
    I am using sql loader to load the data from flat file into the data base
    my file structure is as below
    ====================
    101,john,mobile@@fax@@home@@office@@email,1234@@3425@@1232@@2345@@[email protected],1234.40
    102,smith,mobile@@fax@@home,1234@@345@@234,123.40
    103,adams,fax@@mobile@@office@@others,1234@@1233@@1234@@3456,2345.40
    in file first columns are empno,ename,comm_mode(multiple values terminated by '@@'),comm_no_txt(multiple values terminated by '@@'), sal
    the comm_mode and comm_no_text needs to be inserted into the separate table (emp_comm) like below
    emp
    empno ename sal
    101 john 1234.40
    102 smith 123.40
    103 adams 2345.40
    emp_comm
    empno comm_mode comm_no_text
    101 mobile 1234
    101 fax 3425
    101 home 1232
    101 office 2345
    101 email [email protected]
    102 mobile 1234
    102 fax 345
    102 home 234
    103 fax 1234
    like this needs to insert the data using sql loader
    my table structures
    ===============
    emp
    empno number(5)
    ename varchar2(15)
    sal number(10,2)
    emp_comm
    empno number(5) reference the empno of the emp table
    comm_mode varchar2(10)
    Comm_no_text varchar2(35)
    now i want insert the file data into the specified structues
    please help me out to achieve this using sql loader
    (we are not using external tables for this)
    Thanks & Regards.
    Bala Sake
    Edited by: 954925 on Aug 25, 2012 12:24 AM

    Pl post OS and database details
    You will need to split up the datafile in order to load into separate tables. The process is documented
    http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_control_file.htm#autoId72
    HTH
    Srini

  • Can't Figure Out How To Import XML into a Table?

    HELP!
    I've been using InDesign for several years now... but everything Ive ever done has been basic one off layout concepts.
    I am working on a website for a musical theater actress and for her resume, Id like to make a PDF which lists in table format the show, theatre and role she had for each job.
    I could do this manually... but Id really like to learn how to just reuse the same XML data that I have for her website and import it into InDesign.
    I have looked at Adobe's help file, I have scoured the internet, and I still can't figure it out... I have done like the adobe support file says... and I cant seem to get the values I create in her resume xml file to show up in a table I create in InDesign.
    I even tried to simplify it for the learning process and did something as basic as an XML file that has 5 colors... couldnt even get that working.
    So could someone explain it to me like Im a 5 year old... how to take a XML file, import it, place it in a table and have the data actually show up in the table.
    thanks,
    brian

    Are you sure you want to use XML with tables for this? No doubt importing XML into tables is useful for some specialized tasks, such as importing formatting information inside the XML itself, but for most of the familiar tasks that XML excels at, tables are neither necessary nor useful.
    In my (limited) experience, if the XML elements are well-differentiated, by which I mean different types of data have their own distinctive tags, then the special powers of XML can be exploited more fully using the more familiar tagged text, nested tags etc. in ordinary text frames using paragraph breaks, tab characters, etc. to achieve a suitably "tabular" finished appearance.
    If you must import XML into tables, I recommend Adobe's own PDF "Adobe InDesign CS3 and XML: A Technical Reference" availabe here:
    http://www.adobe.com/designcenter/indesign/articles/indcs3ip_xmlrules.pdf
    It sounds very daunting -- the words "technical reference" make me shudder -- but actually it's very readable and not very technical at all. Some nice pics and everything!
    Jeremy

  • Shell scripts to read data from a text file and to load it into a table

    Hi All,
    I have a text file consisting of rows and columns as follows,
    GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
    GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
    GEF001 000093625 MKL005675 000001 000000 000000 000000 000000 000000 000001 My requirement is that, i should read the first 3 columns of this file using a shell script and then i have to insert the data into a table consisting of 3 rows in oracle .
    the whole application is deployed in unix and that text file comes from mainframe. am working in the unix side of the application and i cant access the data directly from the mainframe. so am required to write a script which reads the data from text file which is placed in certain location and i have to load it to oracle database.
    so I can't use SQL * loader.
    Please help me something with this...
    Thanks in advance.

    1. Create a dictionary object in Oracle and assign it to the folder where your file resides
    2. Write a little procedure which opens the file in the newly created directory object using ULT_FILE and inside the FOR LOOP and do INSERTs to table you want
    3. Create a shell script and call that procedure
    You can use the post in my Blog for such issues
    [Using Oracle UTL_FILE, UTL_SMTP packages and Linux Shell Scripting and Cron utility together|http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

Maybe you are looking for