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.

Similar Messages

  • How to insert data into a table from an xml document

    using the XmlSql Utility, how do I insert data into a table from an xml document, using the sqlplus prompt.
    if i use the xmlgen.insertXML(....)
    requires a CLOB file, which i dont have, only the xml doc.
    Cant i insert directly from the doc to the table?
    the xmlgen examples I have seen first convert a table to a CLOB xmlString and then insert it into another table.
    Isnt there any other way?

    Your question is little perplexing.
    If you're using XML SQL Utility from
    the commandline, just use putXML.
    java OracleXML putXML
    null

  • Problem inserting value in CLOB column from an XML file using XSU

    Hi,
    When I try to insert CLOB value into Oracle9i database from an XML document using XSU, I get an exception as below.
    09:37:32,392 ERROR [STDERR] oracle.xml.sql.OracleXMLSQLException: 'java.sql.SQLException: ORA-03237: Initial Extent of specified size cannot be allocated
    ORA-06512: at "SYS.DBMS_LOB", line 395
    ORA-06512: at line 1
    ' encountered during processing ROW element 0. All prior XML row changes were rolled back. in the XML document.
    All Element tags in XML doc. is mapped to columns in the database. One of the table columns is CLOB. That is the one that gives the above exception. Here is the xml...
    ID - is autogenerated value.
    <?xml version="1.0" ?>
    <ROWSET>
    <ROW num="1">
    <ID></ID>
    <SEQ>
    GCATAGTTGTTATGAAGAAATGGAAGAAAAATGCACTCAAAGTTGGGCTGTCAGGCTGTCTGGGGCTGAATTCTGGTGTGACAGTGTGATGAAGCCATCTTTGAGCCTAAATTTGATAATGAGCCAGTCATGATCTGGTTGTGATTACTATAACAAGATTAAATCTGAATAAGAGAGCCACAACTTCTTTAAAGACAGATTGTCAAGTCATTACATGGAAGAGGGAGATTGCTCCTTTGTAAATCAGGCTGTCAGGCCAACTGAATGAAGGACGTCATTGTACAGTAACCTGATGAAGATCAGATCAACCGCTCACCTCGCCG
    </SEQ>
    </ROW>
    </ROWSET>
    Can anyone identify what's the problem.. and suggest a solution for this..?
    Thanks in advance..
    Viji

    Would you please specify the XDK verison and database version?

  • Insert data into oracle table from XML file

    I need to insert data into oracle table from XML file
    If anybody handled this type of scenario, Please let me know how to insert data into oracle table from XML file
    Thanks in advance

    The XML DB forum provides the best support for XML topics related to Oracle.
    Here's the FAQ on that forum:
    XML DB FAQ
    where there are plenty of examples of shredding XML into Oracle tables and such like. ;)

  • How do I run a database procedure that inserts data into a table from withi

    How do I run a database procedure that inserts data into a table from within a Crystal report?
    I'm using CR 2008 with an Oracle 10i database containing a number of database tables, procedures and packages that provide the data for the reports I'm developing for my department.  However, I'd like to know when a particular report is run and by whom.  To do this I have created a database table called Report_Log and an associated procedure called prc_Insert_Entry that inserts a new line in the table each time it's called.  The procedure has 2 imput parameters (Report_Name & Username), the report name is just text and I'd like the username to be the account name of the person logged onto the PC.  How can I call this procedure from within a report when it's run and provide it with the 2 parameters?  I know the procedure works, I just can't figure out how to call it from with a report.
    I'd be grateful for any help.
    Colin

    Hi Colin, 
    Just so I'm clear about what you want: 
    You have a Stored procedure in your report.  When the report runs, you want that same procedure to write to a table called Report_Log. 
    If this is what you want the simple answer is cannot be done.  Crystal's fundamental prupose is to read only, not write.  That being said, there are ways around this. 
    One way is to have a trigger in your database that updates the Report_Log table when the Stored Procedure is executed.  This would be the most efficient.
    The other way would be to have an application run the report and manage the entry. 
    Good luck,
    Brian

  • How to read .html file and store values into oracle table  from html file

    Hi all ,
    How to read .html file and store values into oracle table from html file using pl/sql
    Please Help.....

    Hi,
    Kindly find following sample html code ,i want to store every value in different column in database .
    <html><body><p/>
    <div style="position:absolute;top:47px;left:37px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:47px;left:680px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;">  
    </div>
    <div style="position:absolute;top:94px;left:151px;font-family:'Times New Roman';font-size:1pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:1080px;left:115px;font-family:'Times New Roman';font-size:8pt;white-space:nowrap;">4497743
    </div>
    <div style="position:absolute;top:1079px;left:442px;font-family:'Times New Roman';font-size:9pt;white-space:nowrap;"> Miclyn Express Offshore Pre-Quotation Disclosure
    </div>
    <div style="position:absolute;top:1079px;left:680px;font-family:'Times New Roman';font-size:9pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:1079px;left:723px;font-family:'Times New Roman';font-size:9pt;white-space:nowrap;">page 5
    </div>
    <div style="position:absolute;top:1083px;left:151px;font-family:'Times New Roman';font-size:1pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:107px;left:151px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Attachment 2 ¿ indicative statement of 20 largest shareholders </b>
    </div>
    <div style="position:absolute;top:139px;left:262px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Name </b>
    </div>
    <div style="position:absolute;top:131px;left:415px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Number of Shares </b>
    </div>
    <div style="position:absolute;top:147px;left:458px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Held </b>
    </div>
    <div style="position:absolute;top:131px;left:560px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Percentage of </b>
    </div>
    <div style="position:absolute;top:147px;left:567px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>shares held </b>
    </div>
    <div style="position:absolute;top:179px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Macquarie Capital Group Limited 92,378,000
    </div>
    <div style="position:absolute;top:179px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:179px;left:618px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">34.00%r
    </div>
    <div style="position:absolute;top:179px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:212px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">HSBC Custody Nominees (Australia)
    </div>
    <div style="position:absolute;top:227px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Limited
    </div>
    <div style="position:absolute;top:220px;left:464px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">36,458,220
    </div>
    <div style="position:absolute;top:220px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:220px;left:618px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">13.42%
    </div>
    <div style="position:absolute;top:220px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:260px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Ray Rider Limited 27,170,000
    </div>
    <div style="position:absolute;top:260px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:260px;left:618px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">10.00%
    </div>
    <div style="position:absolute;top:260px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:300px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:300px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">7.96%
    </div>
    <div style="position:absolute;top:300px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:333px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">National Australia Bank Custodian
    </div>
    <div style="position:absolute;top:348px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Services
    </div>
    <div style="position:absolute;top:341px;left:464px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">12,866,550
    </div>
    <div style="position:absolute;top:341px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:341px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">4.74%
    </div>
    <div style="position:absolute;top:341px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:381px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Citigroup Nominees Pty Ltd 6,942,541
    </div>
    <div style="position:absolute;top:381px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:381px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">2.56%r
    </div>
    <div style="position:absolute;top:381px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:421px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:421px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">2.14%r
    </div>
    <div style="position:absolute;top:421px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:462px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">UBS Securities Australia Ltd 4,806,760
    </div>
    <div style="position:absolute;top:462px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:462px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.77%
    </div>
    <div style="position:absolute;top:462px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:494px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Merrill Lynch Equities (Australia)
    </div>
    <div style="position:absolute;top:510px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Limited
    </div>
    <div style="position:absolute;top:502px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">4,325,000
    </div>
    <div style="position:absolute;top:502px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:502px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.59%
    </div>
    <div style="position:absolute;top:502px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:550px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Equities Ltd
    </div>
    <div style="position:absolute;top:542px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">4,150,000
    </div>
    <div style="position:absolute;top:542px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:542px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.53%
    </div>
    <div style="position:absolute;top:542px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:575px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Bond Street Custodians Limited - A/C
    </div>
    <div style="position:absolute;top:590px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Institutional
    </div>
    <div style="position:absolute;top:583px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">2,750,000
    </div>
    <div style="position:absolute;top:583px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:583px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.01%
    </div>
    <div style="position:absolute;top:583px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:623px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Cogent Investment Operations Pty Ltd 2,599,321
    </div>
    <div style="position:absolute;top:623px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:623px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.96%
    </div>
    <div style="position:absolute;top:623px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:663px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Skeet Nominees Pty Ltd 2,276,736
    </div>
    <div style="position:absolute;top:663px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:663px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.84%
    </div>
    <div style="position:absolute;top:663px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:704px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Diederik de Boer 1,917,561
    </div>
    <div style="position:absolute;top:704px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:704px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.71%
    </div>
    <div style="position:absolute;top:704px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:744px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Ecapital Nominees Pty Limited 1,594,736
    </div>
    <div style="position:absolute;top:744px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:744px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.59%
    </div>
    <div style="position:absolute;top:744px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:777px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Neweconomy Com Au Nominees Pty 9
    </div>
    <div style="position:absolute;top:792px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Limited &#60;900 Account&#62;
    </div>
    <div style="position:absolute;top:784px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1,594,7360
    </div>
    <div style="position:absolute;top:784px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:784px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.59%
    </div>
    <div style="position:absolute;top:784px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:825px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Sonray Capital Markets Pty Ltd 1,236,842
    </div>
    <div style="position:absolute;top:825px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:825px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.46%
    </div>
    <div style="position:absolute;top:825px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:865px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Argo Investments Limited 1,050,000
    </div>
    <div style="position:absolute;top:865px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:865px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.39%
    </div>
    <div style="position:absolute;top:865px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;"> 
    </div>
    <div style="position:absolute;top:905px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Idameno (No 79) Nominees Pty Limited 724,210</div>
    <div style="position:absolute;top:1103px;">
    </body></html>
    Thanks..........................

  • Insert data into fact table from source database tables

    here i try to insert data into fact table from source database tables here is the query 
    ALTER procedure [dbo].[facttable]
    as
    insert into [pp dw].dbo.Dimfact(Prod_ID,Production_ID,Material_ID,Equip_ID,WC_ID,Recipe_ID,Quantity,costprice)
    select Products.[Product ID],[Production ID],Materials.[Material ID],[Equipment ID],[Work Centre ID],[Recipy ID],Quantity,[cost price]
    from
    [PRODUCTION PLANNING 2].dbo.[Products],
    [PRODUCTION PLANNING 2].dbo.[Production Detail],
    [PRODUCTION PLANNING 2].dbo.[Material category],
    [PRODUCTION PLANNING 2].dbo.[Materials],
    [PRODUCTION PLANNING 2].dbo.[Equipment],
    [PRODUCTION PLANNING 2].dbo.[Working Centre] ,
    [PRODUCTION PLANNING 2].dbo.[Recipies]
    where
    Products.[Product ID] in (13, 14, 15, 16, 17) and
    [Production Detail].[Production ID] in (1, 2, 3) and
    [Materials].[Material ID] in (1, 2, 3, 4, 5) and
    [Equipment].[Equipment ID] in (1, 2, 3, 4) and
    [Working Centre].[Work Centre ID] in (1, 2, 3) and
    [Recipies].[Recipy ID] in (1, 2, 3) and
    [Material category].[Category ID] in (8, 9, 10, 11, 12, 13)
    and when i execute query it shows me error 
    The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Dimfact_Dimproduct". The conflict occurred in database "pp dw", table "dbo.Dimproduct", column 'Prod_ID'.
    ERD IS
    HOW TO SOLVE THIS PROBLEM?

    I cant see any join conditions in your query posted. Whats the purpose of the query above. It will just bring you a cartesian product (cross join) of tables involved subjected to filters. Are you sure this is the correct query?
    The error you're getting may be because you've not yet populated DimProduct or may be because of logic you used in popultaing DimProduct causing it to miss some records which is what query is referring to in above case.
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Inserting values into multiple tables in one jsf page with single commit op

    hi all,
    i have two tables ,
    one is parent table and other is child record.
    record details:
    table1:(parent table)
    emplid (primary key)
    empl_name
    table 2:(child table)
    empl id ( Foreign key)
    empl_name ( Foreign key)
    contact_no (primary key)
    my senario is , i need insert values into both parent and child table in one save option.
    and both the tables will be in one jsf page.
    is this possible to do?
    thanks all,
    regards,
    M vijayalakshmi

    hi,
    i feel my question is not clear.
    let me explain my question clearly.
    1. i have two records
    *1. emp_names*
    attributes of this table is 1.emplid
    2.emp_name.
    emplid is a primary key.
    2. emp_contact
    attributes of this table is 1.emplid
    2. contact_no
    In this table emplid is forigen key from emp_name table
    contact_no is primary key.
    and my senerio is,
    for one emplid there are many contact no.
    in database diagram i have created these two entities. and from that i have generated two views objects.
    now in jsf page ,
    i shd have all fields from both the records.
    wn ever i click on add button , i shd be able to insert one complete row of data to both the tables.
    means,
    emplid
    empl_name
    contact_no.
    and if i click on commit button data shd be insert in both the tables.
    so how to achive this?
    am very beginner to the jdeveloper tool.
    regards,
    m vijayalakshmi.

  • Need to insert rows into 100 tables at a time

    hi there,
    below is our script for creation of 100 tables...
    we need a plsql script, to insert rows into 100 tables at a single time...
    please help us...vey urgent...
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2(2000);
    BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_table'||counter||'
    (id integer primary key, col_a VARCHAR2(42),col_b date,col_c number,col_d varchar2(20),col_e varchar2(20),
    col_f varchar2(20),col_g varchar2(20),col_h date,col_i varchar2(20),col_j varchar2(20),col_k date)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END;
    /

    hi,
    below is our procedure and the error we are getting...
    Name Null? Type
    ID VARCHAR2(10)
    COL_A VARCHAR2(10)
    COL_B VARCHAR2(10)
    COL_C VARCHAR2(10)
    COL_D VARCHAR2(10)
    COL_E VARCHAR2(10)
    COL_F VARCHAR2(10)
    COL_G VARCHAR2(10)
    COL_H VARCHAR2(10)
    COL_J DATE
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2(4000);
    BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_a'||counter||'
    (id varchar2(10), col_a varchar2(10), col_b varchar2(10), col_c varchar2(10), col_d varchar2(10), col_e varchar2(10),
    col_f varchar2(10), col_g varchar2(10), col_h varchar2(10), col_j date)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END;
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2 (2000);
    BEGIN
    FOR OuterCounter IN 1 .. 100 LOOP --- table prefix in which it is to be inserted
    FOR InnerCounter IN 1 .. 100 LOOP --- records to be inserted
    sql_string := 'INSERT INTO emp_a' || Outercounter || ' (id, col_a, col_b, col_c, col_d, col_e, col_f, col_g, col_h, col_j)
    VALUES ('
    || InnerCounter || ', to_char( ''col_a''' || innercounter || '),'
    || InnerCounter || ', to_char( ''col_d''' || innercounter || '),'
    || ', to_char( ''col_e''' || innercounter || '),'
    || ', to_char( ''col_f''' || innercounter || '),'
    || ', to_char( ''col_g''' || innercounter || '),'
    || ', to_char( ''col_h''' || innercounter || '),'
    || ', to_char( ''col_j''' || innercounter || '), SYSDATE)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END LOOP;
    END;
    DECLARE
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    ORA-06512: at line 17
    please check the procedure and write the correct one...

  • SQL Server 2012 Management Studio: Creating a Database and a dbo Table. Inserting VALUES into the table. How to insert 8 Values for future use in XQuery?

    Hi all,
    In my SQL Server 2012 Management Studio (SSMS2012), I tried to create a Database (MacLochainnsDB) and a dbo Table (marvel). then I wanted insert 8 VALUES into the Table by using the following code:
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'MacLochlainnsDB')
    DROP DATABASE MacLochlainnsDB
    GO
    CREATE DATABASE MacLochlainnsDB
    GO
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL)
    INSERT INTO marvel
    (avenger_name)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8)
    I got the following error Message:
    Msg 110, Level 15, State 1, Line 5
    There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
    How can I correct this problem?
    Please kindly help and advise.
    Thanks in advance,
    Scott Chang
    P. S.
    The reason I tried to create the Database, dbo Table, and then to insert the VALUES is to learn the following thing:
    You can query the entire node tree with the following xquery statement because it looks for the occurrence of any node with the /* search string:
    DECLARE @x xml;
    SET @x = N'<marvel>
    <avenger_name>Captain America</avenger_name>
    </marvel>';
    SELECT @x.query('/*');
    You can query the avenger_name elements from the marvel_xml table with the following syntax:
    SELECT xml_table.query('/marvel/avenger_name')
    FROM marvel_xml;
    It returns the following set of avenger_name elements:
    <avenger_name>Hulk</avenger_name>
    <avenger_name>Iron Man</avenger_name>
    <avenger_name>Black Widow</avenger_name>
    <avenger_name>Thor</avenger_name>
    <avenger_name>Captain America</avenger_name>
    <avenger_name>Hawkeye</avenger_name>
    <avenger_name>Winter Soldier</avenger_name>
    <avenger_name>Iron Patriot</avenger_name>
    You can query the fourth avenger_name element from the marvel_xml table with the following xquery statement:
    SELECT xml_table.query('/marvel[4]/avenger_name')
    FROM marvel_xml;
    It returns the following avenger_name element:
    <avenger_name>Thor</avenger_name>

    Hi Scott,
    The master database records all the system-level information for a SQL Server system, so best practise would be not to create any user-defined
    object within it.
    To change your default database(master by default) of your login to another, follow the next steps so that next time when connected you don't have to use "USE dbname" to switch database.
    Open SQL Server Management Studio
    --> Go to Object explorer(the left panel by default layout)
    --> Extend "Security"
    --> Extend "Logins"
    --> Right click on your login, click "propertites"
    --> Choose the "Default database" at the bottom of the pop-up window.
    --or simply by T-SQL
    Exec sp_defaultdb @loginame='yourLogin', @defdb='youDB'
    Regarding your question, you can reference the below.
    SELECT * FROM master.sys.all_objects where name ='Marvel'
    --OR
    SELECT OBJECT_ID('master.dbo.Marvel') --if non empty result returns, the object exists
    --usually the OBJECT_ID is used if a if statement as below
    IF OBJECT_ID('master.dbo.Marvel') IS NOT NULL
    PRINT ('TABLE EXISTS') --Or some other logic
    What is the sys.all_objects? See
    here.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Insert data into oracle table from XML script not working

    Hi,
    I wrote simple PL/SQL program to extract values from a XML file and disply all the employee names. But the first employee name repeating. Please can you tell me how to fix it.
    set serveroutput on size 2000;
    declare
    indoc VARCHAR2(2000);
    indomdoc dbms_xmldom.domdocument;
    innode dbms_xmldom.domnode;
    myParser dbms_xmlparser.Parser;
    l_nl dbms_xmldom.DOMNodeList;
    lv_value varchar2(30);
    l_n dbms_xmldom.DOMNode;
    begin
    indoc := '<emp> <name> Scott </name>
    <name> Tiger </name>
    </emp>';
    myParser := dbms_xmlparser.newParser;
    dbms_xmlparser.parseBuffer(myParser, indoc);
    indomdoc := dbms_xmlparser.getDocument(myParser);
    innode := dbms_xmldom.makeNode(indomdoc);
    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(indomdoc),'/emp/name');
    dbms_output.put_line('Record count '||dbms_xmldom.getLength(l_nl));
    FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
    l_n := dbms_xmldom.item(l_nl, cur_emp);
    lv_value := dbms_xslprocessor.valueOf(l_n,'//name/text()');
    dbms_output.put_line('Emp Name : '||lv_value);
    END LOOP;
    end;
    /

    Based on an earlier example of mine from {message:id=2826611}
    This works in 10.2.x.x for sure. I can't recall (didn't look up) whether in 10.1 it allowed for going straight from a CLOB to a DOMDocument via newDomDocument.
    declare
       indoc    VARCHAR2(2000);
       indomdoc dbms_xmldom.domdocument;
       l_nl     dbms_xmldom.DOMNodeList;
       lv_value VARCHAR2(30);
       l_n      dbms_xmldom.DOMNode;
       l_xmltype   XMLTYPE;
       l_index     PLS_INTEGER;
    begin
       indoc := '<emp> <name> Scott </name>
       <name> Tiger </name>
       </emp>';
       indomdoc := dbms_xmldom.newDomDocument(indoc);
       l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(indomdoc),'/emp/name');
       dbms_output.put_line('Record count '||dbms_xmldom.getLength(l_nl));
       -- Method 1
       FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
          l_n := dbms_xmldom.item(l_nl, cur_emp);
          lv_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_n));
          dbms_output.put_line('Emp Name : '||lv_value);
       END LOOP;
       dbms_xmldom.freeDocument(indomdoc);
       -- Method 2
       dbms_output.new_line;
       l_xmltype := XMLTYPE(indoc);
       l_index := 1;
       WHILE l_xmltype.Existsnode('/emp/name[' || To_Char(l_index) || ']') > 0
       LOOP
          lv_value := l_xmltype.extract('/emp/name[' || To_Char(l_index) || ']/text()').getStringVal();
          dbms_output.put_line('Emp Name : '||lv_value);
          l_index := l_index + 1;
       END LOOP;
    end;

  • XML Parser to insert values into a Table??

    Hi All,
    Bare with me I am new to xml technology, but apparently there's request to parse a xml file and store data in a oracle table.
    Appreciate if someone can help me to resolve this please??
    I am using Oracle 10g.
    This is the xml file which I need to parse.
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <PBOOKS>
    <BOOK>
    <KEY>0061319821</KEY>
    <ISBN>0-061-31982-1</ISBN>
    <![CDATA[<TTL>All Our Kin</TTL>]]>
    <![CDATA[<SUBTTL>Strategies For Survival In A Black Community</SUBTTL>]]>
    <![CDATA[<PAGES>192</PAGES>]]>
    </BOOK>
    </PBOOKS>
    I have a Oracle Table ( table name: Perseu ) to hold the values of this file:
    These are the fields:
    Key, ISBN, TTL, SUBTTL, Pages

    Due to the somewhat strange structure of the XML (Elements embedded inside the CDATA sections, do you have any idea why this is being done ?) the best I can come up with is
    SQL> drop table test
      2  /
    Table dropped.
    SQL> create table test of XMLType
      2  /
    Table created.
    SQL> insert into test values ( XMLTYPE(
      2  '<PBOOKS>
      3     <BOOK>
      4             <KEY>0061319821</KEY>
      5             <ISBN>0-061-31982-1</ISBN><![CDATA[<TTL>All Our Kin</TTL>]]><![CDATA[<SUBTTL>Strategies For Survival In A Black Community</S
    UBTTL>]]><![CDATA[<PAGES>192</PAGES>]]></BOOK>
      6  </PBOOKS>'))
      7  /
    1 row created.
    SQL> select BOOK, ISBN,
      2         extractValue(CDATA,'/CDATA/TTL') TTL,
      3         extractValue(CDATA,'/CDATA/SUBTTL') SUBTL,
      4         extractValue(CDATA,'/CDATA/PAGES') PAGES
      5    from (
      6           select extractValue(value(BOOK),'/BOOK/KEY') BOOK,
      7                  extractValue(value(BOOK),'/BOOK/ISBN') ISBN,
      8                  xmlType('<CDATA>' || extractValue(value(BOOK),'BOOK/text()') || '</CDATA>') CDATA
      9             from test,
    10                  table(xmlsequence(extract(object_value,'/PBOOKS/BOOK'))) book
    11         )
    12  /
    BOOK
    ISBN
    TTL
    SUBTL
    PAGES
    0061319821
    0-061-31982-1
    All Our Kin
    BOOK
    ISBN
    TTL
    SUBTL
    PAGES
    Strategies For Survival In A Black Community
    192
    SQL>
    SQL>
    SQL>

  • How to parse XML Column and insert values into a table

    Hello,
    I am working on a simple project to demonstrate how to load and extract XML using SQL, I have already made a table that contains a column of XMLTYPE and loaded an XML file into it (code below)
    create or replace directory XMLSRC as 'C:\XMLSRC';
    drop table Inventory;
    create table Inventory(Inv XMLTYPE);
    INSERT INTO Inventory VALUES (XMLTYPE(bfilename('XMLSRC', 'Inventory.xml'),nls_charset_id('AL32UTF')));
    select * from Inventory;
    I now however need to get the XML data back out of that and loaded into a new table. Troubleshooting guides I have read online seem to only be dealing with parsing an external XML document and loading it into a table, and not what I need to do which is parse a column of XML data and load that into a table. The project trivial with simple tables containing only 3 columns.
    The table that needs to be loaded is as follows:
    create table InventoryOut(PartNumber Number(10), QTY Number(10), WhLocation varchar2(500));
    The XML document is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Inventory.xsd" generated="2012-04-09T17:36:30">
    <Inventory>
    <PartNumber>101</PartNumber>
    <QTY>12</QTY>
    <WhLocation>WA</WhLocation>
    </Inventory>
    </dataroot>
    Thank you for any help you can offer.

    First of all, thank you for your help!! Still stunned that you actually took the time to write out an eample using my tables/names/etc. Thank you!!
    Attached is the code, there seems to be an issue with referencing the other table, Inventory.Inv, I checked and that table and the Inv column are showing up in the database so I am not sure why it is having issues locating them, take a look at the code I wrote as well as the output (*I included the real version number for you this time :)
    EDIT: In your code right here:
    select xt.*
    3 from Inventory inve,
    4 XMLTable('/dataroot/Inventory'
    5 PASSING inve.Inv
    I think is where I am messing it up, perhaps not understanding fully what is going on, as you write "Inventory inve" and "inve.Inv" ---- Is inve a keyword that I am just not familiar with? I think this is where the issues lies in my code.
    END EDIT
    EDIT2: Well that looks like it was it, changed that to how you have it and it now works!!! Could you please explain what that few lines is doing, and what the xt.* and inve are doing? Thanks again!!!
    END EDIT2
    drop table InventoryOut;
    create table InventoryOut (PartNumber number(10), QTY number(10), WhLocation varchar2(500));
    insert into InventoryOut (PartNumber, QTY, WhLocation)
    select xt.*
    from Inventory Inv,
    XMLTable('/dataroot/Inventory'
    PASSING Inventory.Inv COLUMNS
    PartNumber number path 'PartNumber',
    QTY number path 'QTY',
    WhLocation path 'WhLocation')xt;
    select * from InventoryOut;
    select * from v$version;
    table INVENTORYOUT dropped.
    table INVENTORYOUT created.
    Error starting at line 4 in command:
    insert into InventoryOut (PartNumber, QTY, WhLocation)
    select xt.*
    from Inventory Inv,
    XMLTable('/dataroot/Inventory'
    PASSING Inventory.Inv COLUMNS
    PartNumber number path 'PartNumber',
    QTY number path 'QTY',
    WhLocation path 'WhLocation')xt
    Error at Command Line:8 Column:12
    Error report:
    SQL Error: ORA-00904: "INVENTORY"."INV": invalid identifier
    00904. 00000 - "%s: invalid identifier"
    *Cause:   
    *Action:
    PARTNUMBER QTY WHLOCATION
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    If this helps here is the code and output for the creation of the Inventory table itself:
    create or replace directory XMLSRC as 'C:\XMLSRC';
    drop table Inventory;
    create table Inventory(Inv XMLTYPE);
    INSERT INTO Inventory VALUES (XMLTYPE(bfilename('XMLSRC', 'Inventory.xml'),nls_charset_id('AL32UTF')));
    select * from Inventory;
    directory XMLSRC created.
    table INVENTORY dropped.
    table INVENTORY created.
    1 rows inserted.
    INV
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Inventory.xsd" generated="2012-04-09T17:36:30">
    <Inventory>
    <PartNumber>101</PartNumber>
    <QTY>12</QTY>
    <WhLocation>WA</WhLocation>
    </Inventory>
    </dataroot>
    Thanks again for your help so far! Hope we can get this working :)
    Edited by: 926502 on Apr 11, 2012 2:47 PM
    Edited by: 926502 on Apr 11, 2012 2:49 PM
    Edited by: 926502 on Apr 11, 2012 2:54 PM
    Edited by: 926502 on Apr 11, 2012 2:54 PM
    Updated issue to solved - Edited by: 926502 on Apr 11, 2012 2:55 PM

  • Trying to insert values into a table inserts the wrong values

    Hi, I'm sure this is quite simple but I don't know why it is happened (Spent about 2 hours debugging my program only to find the error is actually in the SQL insert statement not working properly hehe)
    I have a simple Payment table with the following columns:
    int - ID (primary key)
    int - Amount
    int - Paid
    varchar - Notes
    I try to place a new record into the table as follows:
    insert into payment values (1010,50,1,'Hello')
    but the ID i choose is not added to the record, rather the database assigns a ID instead automatically (it seems to add 1 to the last ID)
    On further inspection this happens for another of my tables too, however for another table, this does not happen and I can assign an ID as I would like.
    When creating my tables I thought I set them all up the same, however I guess not
    Does anyone know the problem?
    Thanks

    Hi,
    Are you are using this INSERT statement in any form??? if so, please check your pre-insert trigger.
    If not, then you may verify it by inserting it through iSQLPlus. If it doesn't insert your data, then check the database triggers associated with INSERT for your table.
    Regards,
    Zaaf

  • Error while loading  data into External table from the flat files

    HI ,
    We have a data load in our project which feeds the oracle external tables with the data from the Flat Files(.bcp files) in unix.
    While loading the data, we are encountering the following error.
    Error occured (Error Code : -29913 and Error Message : ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04063: un) while loading data into table_ext
    Please let us know what needs to be done in this case to solve this problem.
    Thanks,
    Kartheek

    Kartheek,
    I used Google (mine still works).... please check those links:
    http://oraclequirks.blogspot.com/2008/07/ora-29400-data-cartridge-error.html
    http://jonathanlewis.wordpress.com/2011/02/15/ora-29913/
    HTH,
    Thierry

Maybe you are looking for