Want to load an xml document directly into an Oracle table

From the Oracle XML Applications book pg: 106/107
there is an example where it inserts into a Oracle table from the xml_documents table. What I would like to do is insert directly from the xml document and was able to but not able to get rid of the inserting into xml_documents section.
CREATE OR REPLACE PROCEDURE insertXmlFile( dir VARCHAR2,
file VARCHAR2,
myTable varchar2,
name VARCHAR2 := NULL) IS
theBFile BFILE;
theCLob CLOB;
theDocName VARCHAR2(200) := NVL(name,file);
BEGIN
-- (1) Insert a new row into xml_documents with an empty CLOB, and
-- (2) Retrieve the empty CLOB into a variable with RETURNING..INTO
INSERT INTO xml_documents(XML_DOCUMENT_NM,XML_DOCUMENT_TX)
VALUES('DELETE ME',empty_clob())
RETURNING XML_DOCUMENT_TX INTO theCLob;
-- (3) Get a BFile handle to the external file
theBFile := BFileName(dir,file);
-- (4) Open the file
dbms_lob.fileOpen(theBFile);
-- (5) Copy the contents of the BFile into the empty CLOB
dbms_lob.loadFromFile(dest_lob => theCLob,
src_lob => theBFile,
amount => dbms_lob.getLength(theBFile));
-- (5a) Insert the rows into the proper table
insProc(theClob, myTable);
-- (6) Close the file and commit
dbms_lob.fileClose(theBFile);
delete from xml_documents
where xml_document_nm = 'DELETE ME';
COMMIT;
END;
execute insertXmlFile ('XMLFILES','emp.xml','emp')

Yes I would like to insert directly from an emp.xml file and load it directly into an emp table and not have to load the document in the xml_documents table and then insert into the emp table like I am doing in this procedure.

Similar Messages

  • How to load XML audit trail into an oracle table

    Gents,
    I have a task to load XML sys audit information into a database table.
    Here is a sample audit.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <Audit xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd">
    <Version>11.1</Version>
    <AuditRecord><Audit_Type>8</Audit_Type><EntryId>1</EntryId><Extended_Timestamp>2011-05-04T15:44:08.311370</Extended_Timestamp><DB_User>/</DB_User><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Terminal>pts/11</Terminal><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>CONNECT</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>1</StatementId><EntryId>2</EntryId><Extended_Timestamp>2011-05-04T15:44:12.496857</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>ALTER DATABASE OPEN</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>4</StatementId><EntryId>3</EntryId><Extended_Timestamp>2011-05-04T15:44:32.863959</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>SELECT name, value
    FROM gv$parameter
    WHERE name LIKE '%audit%'</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>5</StatementId><EntryId>4</EntryId><Extended_Timestamp>2011-05-04T15:44:50.448443</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>select count(*) from v$session</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>6</StatementId><EntryId>5</EntryId><Extended_Timestamp>2011-05-04T15:46:37.680404</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>select count(*) from v$session</Sql_Text>
    </AuditRecord>
    </Audit>
    I am using the following code to load it:
    create or replace directory test_dir as '/dbms/oracle/work/sh82993'
    drop table xxrp_acct_header
    create table xxrp_acct_header (
    Audit_Type number,
    Sql_Text varchar2(100)
    DECLARE
    acct_doc xmltype := xmltype( bfilename('TEST_DIR','dbmsdev_ora_720942_1.xml')
    , nls_charset_id('UTF-8') );
    BEGIN
    insert into xxrp_acct_header (Audit_Type, Sql_Text)
    select *
    from xmltable(
    '/Audit/AuditRecord'
    passing acct_doc
    columns Audit_Type path 'Audit_Type'
    , Sql_Text path 'Sql_Text'
    END;
    COMMIT;
    select * from xxrp_acct_header
    However I am having problems with the <Audit .... > tag.
    If a strip the rest following Audit I can get it working but if I leave the part:
    xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd">
    the loading will not work.
    Any ideas?
    All will be appreciated.
    steven

    odie_63 wrote:
    Hi,
    The XML has a default namespace, so you must declare it in XMLTable :
    SELECT *
    FROM XMLTable(
    XMLNamespaces(default 'http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd'),
    '/Audit/AuditRecord'
    passing acct_doc
    columns Audit_Type number        path 'Audit_Type'
    , Sql_Text   varchar2(100) path 'Sql_Text'
    Hi ,
    Can you please tell how can I load the data in the column "Extended_Timestamp" , I defined the column with datatype "TIMESTAMP" in the table but its giving error 'ORA-01830: date format picture ends before converting entire input string" .
    I also tried to add a column with datatype "TIMESTAMP(6) with time Zone" but still giving the same error. What shld be the datatype of the column which will store the corresponding data from extended_timestamp or do I need to format the insert statement , if yes then how ?
    Thanks.

  • Error while loading an XML document using a structured application

    Hi,
    I try to load an XML document using a structured application defined in the default structapps.fm
    My code is shown down, extracted from the FDK API code sample.
    Problem, I always have the same message :
    "Cannot find the file named e:\xml\AdobeFrameMaker10\file. Make sure that the file exists. "
    Where "e:\xml\AdobeFrameMaker10\" is my install directory.
    So I assume that frame try to find the structapps.fm file but does not find it.
    What else can it be ?
    Does anyone knowns how to achieve this simple task using extendScript ?
    Thanks for any comments, Pierre
    function openXMLFile(myLastFile) {
        var filename = myLastFile.openDlg("Choose XML file ...", "*.xml", false);
        if (filename != null) {
            /* Get default open properties. Return if it can’t be allocated. */
            var params = GetOpenDefaultParams();
            /* Set properties to open an XML document*/
            /*Specify XML as file type to open*/
            var i = GetPropIndex(params, Constants.FS_OpenAsType)
            params[i].propVal.ival = Constants.FV_TYPE_XML;
            /* Specify the XML application to be used when opening the document.*/
            i = GetPropIndex(params, Constants.FS_StructuredOpenApplication)
            params[i].propVal.sval = "myApp";
            i = GetPropIndex(params, Constants.FS_FileIsOldVersion)
            params[i].propVal.ival = Constants.FV_DoOK
            i = GetPropIndex(params, Constants.FS_FontNotFoundInDoc)
            params[i].propVal.ival = Constants.FV_DoOK
            i = GetPropIndex(params, Constants.FS_FileIsInUse)
            params[i].propVal.ival = Constants.FV_DoCancel
            i = GetPropIndex(params, Constants.FS_AlertUserAboutFailure)
            params[i].propVal.ival = Constants.FV_DoCancel
            /*The structapps.fm file containing the specified application must have
            already been read. The default structapps.fm file is read when FrameMaker is
            opened so this shouldn't be a problem if the application to be used is
            listed in the structapps.fm file.*/
            var retParm = new PropVals()
            var fileObj = Open(filename, params, retParm);
            return fileObj
        } else {
            return null;

    Pierre,
    Depending on the object "myLastFile", the method openDlg might not even exist (if the myLastFile object is not a File object, for instance). And I do not see any need for the myLastFile anyhow, as you are presenting a dialog to select a file to open. I recommend using the global ChooseFile( ) method instead. This will give you a filename as string in full path notation, or null when no file was selected in the dialog. I am not sure what your ExtendScript documentation states about the return value for ChooseFile, but if that differs from what I am telling you here, the documentation is wrong. So, if you replace the first lines of your code with the following it should work:
    function openXMLFile ( ) {
        var filename = ChooseFile ( "Choose XML file ...", "", "*.xml", Constants.FV_ChooseSelect );
    While writing this, I see that Russ has already given you the same advice. Use the symbolic constant value I indicated to use the ChooseFile dialog to select a single file (it can also be used to select a directory or open a file - but you want to control the opening process yourself). Note that this method allows you to set a start directory for the dialog (second parameter). The ESTK autocompletion also gives you a fifth parameter "helplink" which is undocumented and can safely be ignored.
    Good luck
    Jang

  • Problem when trying to load an XML document with DTD or XML SCHEMA

    Hello
    I have tried to load an XML document in Data Services, and I created the xsd file and Dtd file. (With altova xml spy software automatically) to import into SAP Data Services 3.2. .
    In Data Services I created the dtd import file DTD and then called the XML file from the DTD (the xml file is validated vs the dtd file), and I could not read the xml correctly because it tells me that an ELEMENT called <item> expected joiners who did not come in the structure of import (dtd), but if the xml.
    I understand that the document root is the label: CUSTOMER_FULL_2014, the data flow is as follows:CARGA_XML_CUSTOMER |
    Turns out the joiners element is used to separate the xml elements are repeated, but is used at different levels. My idea is that the design will dtd second, or something I'm missing or is incorrectly stated.
    Thank you.
    xml
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    <?xml version="1.0" encoding="utf-8"?>
    <CUSTOMER_FULL_2014>
      <item>
      <CUST_NO>202222</CUST_NO>
      <ADDRESS>
      <item>
      <SHIP_TO>202222</SHIP_TO>
      <NAME1>Henley.</NAME1>
      <STREET>Vitacura #40</STREET>
      <CITY>LIMA</CITY>
      </item>
      </ADDRESS>
      <EQUIPMENT>
      <item>
      <EQUI_NO>81623</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>81633</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>81993</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>82003</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>82013</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>82103</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>82113</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>581203</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>900003-EMER</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>9000033-STOCK</EQUI_NO>
      </item>
      </EQUIPMENT>
      <STORAGE_LOC>
      <item>
      <STOR_LOC_NO>0001</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      </item>
      <item>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 henley</DESCRIPTION>
      </item>
      </STORAGE_LOC>
      </item>
      <item>
      <CUST_NO>2007933434343</CUST_NO>
      <ADDRESS>
      <item>
      <SHIP_TO>2007933434343</SHIP_TO>
      <NAME1>Campos de Almacenaje SA</NAME1>
      <STREET>Calacoto2, Calle 1</STREET>
      <HOUSE_NO>Piso 1</HOUSE_NO>
      <CITY>La Paz</CITY>
      </item>
      </ADDRESS>
      <EQUIPMENT>
      <item>
      <EQUI_NO>90000-EMER</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>90000333-STOCK</EQUI_NO>
      </item>
      </EQUIPMENT>
      <STORAGE_LOC>
      <item>
      <STOR_LOC_NO>00012</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      </item>
      <item>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 henley</DESCRIPTION>
      </item>
      </STORAGE_LOC>
      </item>
      <item>
      <CUST_NO>200801333</CUST_NO>
      <ADDRESS>
      <item>
      <SHIP_TO>200801333</SHIP_TO>
      <NAME1>CONSTRUCTORA SA.</NAME1>
      <STREET>Ruta Panamericana Km 100</STREET>
      <CITY>San Antonio 23</CITY>
      </item>
      </ADDRESS>
      <EQUIPMENT>
      <item>
      <EQUI_NO>1507933</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>1509733</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>90000-EMER</EQUI_NO>
      </item>
      <item>
      <EQUI_NO>90000333-STOCK</EQUI_NO>
      </item>
      </EQUIPMENT>
      <STORAGE_LOC>
      <item>
      <STOR_LOC_NO>0001</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      </item>
      <item>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 henley</DESCRIPTION>
      </item>
      </STORAGE_LOC>
      </item>
    </CUSTOMER_FULL_2014>
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ARCHIVO DTD CREADO (automáticamente con xml spy)
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- DTD generado con XMLSpy v2014 rel. 2 (x64) (http://www.altova.com) -->
    <!ELEMENT CITY (#PCDATA)>
    <!ELEMENT item ((SHIP_TO, NAME1, STREET, HOUSE_NO?, CITY) | (CUST_NO, ADDRESS, EQUIPMENT, STORAGE_LOC) | (STOR_LOC_NO, DESCRIPTION) | EQUI_NO)>
    <!ELEMENT NAME1 (#PCDATA)>
    <!ELEMENT STREET (#PCDATA)>
    <!ELEMENT ADDRESS (item)>
    <!ELEMENT CUST_NO (#PCDATA)>
    <!ELEMENT EQUI_NO (#PCDATA)>
    <!ELEMENT SHIP_TO (#PCDATA)>
    <!ELEMENT HOUSE_NO (#PCDATA)>
    <!ELEMENT EQUIPMENT (item+)>
    <!ELEMENT DESCRIPTION (#PCDATA)>
    <!ELEMENT STORAGE_LOC (item+)>
    <!ELEMENT STOR_LOC_NO (#PCDATA)>
    <!ELEMENT CUSTOMER_FULL_2014 (item+)>
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    The error of MONITOR Data Services
    11676
    5184
    XML-240108
    11-04-2014 17:34:16
    |Data flow CARGA_XML_CUSTOMER|Reader READ MESSAGE customer OUTPUT(customer)
    11676
    5184
    XML-240108
    11-04-2014 17:34:16
    An element named <item> present in the XML data input does not exist in the XML format used to set up this XML source in data
    11676
    5184
    XML-240108
    11-04-2014 17:34:16
    flow <CARGA_XML_CUSTOMER>. Please validate your XML data.
    11676
    5184
    XML-240307
    11-04-2014 17:34:16
    |Data flow CARGA_XML_CUSTOMER|Reader READ MESSAGE customer OUTPUT(customer)
    11676
    5184
    XML-240307
    11-04-2014 17:34:16
    XML parser failed: See previously displayed error message.
    The Error from Monitor
    The metadata DTD
    Thanks
    Juan

    Hi Juan Juan,
    I generated a new XSD file using MS Visual Studio based on your XML file.
    The empty spaces in the source is replaced with <Null> in the target table.
    Here is the XSD:
    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="CUSTOMER_FULL_20140207_033015_001">
            <xs:complexType>
                <xs:sequence>
                    <xs:choice maxOccurs="unbounded">
                        <xs:element name="CUST_NO" type="xs:unsignedInt" />
                        <xs:element name="ADDRESS">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element name="SHIP_TO" type="xs:unsignedInt" />
                                    <xs:element name="NAME1" type="xs:string" />
                                    <xs:element name="STREET" type="xs:string" />
                                    <xs:element minOccurs="0" name="HOUSE_NO" type="xs:string" />
                                    <xs:element name="CITY" type="xs:string" />
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                        <xs:element name="EQUIPMENT">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element maxOccurs="unbounded" name="EQUI_NO" type="xs:string" />
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                        <xs:element name="STORAGE_LOC">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:choice maxOccurs="unbounded">
                                        <xs:element name="STOR_LOC_NO" type="xs:unsignedByte" />
                                        <xs:element name="DESCRIPTION" type="xs:string" />
                                    </xs:choice>
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                    </xs:choice>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    </xs:schema>
    For Source XML
    <?xml version="1.0" encoding="utf-8"?>
    <CUSTOMER_FULL_20140207_033015_001>
      <CUST_NO>200530</CUST_NO>
      <ADDRESS>
      <SHIP_TO>903533</SHIP_TO>
      <NAME1>HENLEY - PART MAQUINARIAS S.A.</NAME1>
      <STREET>Dean Camilo # 148, San Carlos</STREET>
      <CITY>LIMA</CITY>
      </ADDRESS>
      <EQUIPMENT>
      <EQUI_NO>4442</EQUI_NO>
      <EQUI_NO>8163</EQUI_NO>
      <EQUI_NO>8199</EQUI_NO>
      <EQUI_NO>8200</EQUI_NO>
      <EQUI_NO>8201</EQUI_NO>
      <EQUI_NO>8210</EQUI_NO>
      <EQUI_NO>8211</EQUI_NO>
      <EQUI_NO>58120</EQUI_NO>
      <EQUI_NO>90000-EMERGENCY</EQUI_NO>
      <EQUI_NO>90000-STOCK</EQUI_NO>
      </EQUIPMENT>
      <STORAGE_LOC>
      <STOR_LOC_NO>0001</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 HEN</DESCRIPTION>
      </STORAGE_LOC>
      <CUST_NO>200793</CUST_NO>
      <ADDRESS>
      <SHIP_TO>200793</SHIP_TO>
      <NAME1>Minera San Cristobal S.A.</NAME1>
      <STREET>Calacoto, Calle 90, Torre 2</STREET>
      <HOUSE_NO>Piso 5</HOUSE_NO>
      <CITY>La Paz</CITY>
      </ADDRESS>
      <EQUIPMENT>
      <EQUI_NO>90000-EMERGENCY</EQUI_NO>
      <EQUI_NO>90000-STOCK</EQUI_NO>
      </EQUIPMENT>
      <STORAGE_LOC>
      <STOR_LOC_NO>0001</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 HEN</DESCRIPTION>
      </STORAGE_LOC>
      <CUST_NO>200801</CUST_NO>
      <ADDRESS>
      <SHIP_TO>200801</SHIP_TO>
      <NAME1>ISEMAR S.A.</NAME1>
      <STREET>Ruta Km 28.45</STREET>
      <CITY>Don Torcuato Paraguay</CITY>
      </ADDRESS>
      <EQUIPMENT>
      <EQUI_NO>15079</EQUI_NO>
      <EQUI_NO>15097</EQUI_NO>
      <EQUI_NO>90000-EMERGENCY</EQUI_NO>
      <EQUI_NO>90000-STOCK</EQUI_NO>
      </EQUIPMENT>
      <STORAGE_LOC>
      <STOR_LOC_NO>0001</STOR_LOC_NO>
      <DESCRIPTION>01 Parts Center</DESCRIPTION>
      <STOR_LOC_NO>0056</STOR_LOC_NO>
      <DESCRIPTION>56 HEN</DESCRIPTION>
      </STORAGE_LOC>
    </CUSTOMER_FULL_20140207_033015_001>
    Output:
    Regards,
    Akhileshkiran.

  • Need to Load data in XML file into multiple Oracle tables

    Experts
    I want to load data that is stored at XML file into multiple Oracle table using plsql.
    I am novice in this area.Kindly explain in depth or step by step so that i can achive this.
    Thanks in advnace.

    Hi,
    extract your xml and then you can use insert all clause.
    here's very small example on 10.2.0.1.0
    SQL> create table table1(id number,val varchar2(10));
    Table created.
    SQL> create table table2(id number,val varchar2(10));
    Table created.
    SQL> insert all
      2  into table1 values(id,val)
      3  into table2 values(id2,val2)
      4  select extractValue(x.col,'/a/id1') id
      5        ,extractValue(x.col,'/a/value') val
      6        ,extractValue(x.col,'/a/value2') val2
      7        ,extractValue(x.col,'/a/id2') id2
      8  from (select xmltype('<a><id1>1</id1><value>a</value><id2>2</id2><value2>b</value2></a>') col from dual) x;
    2 rows created.
    SQL> select * from table1;
            ID VAL                                                                 
             1 a                                                                   
    SQL> select * from table2;
            ID VAL                                                                 
             2 b                                                                    Ants

  • Is there a preferred format of XML that can be laoded into an Oracle table?

    XML files vary quite a bit. From mere fragments to file carrying schema, etc. What is the preferred format of an XML file that can be loaded into an Oracle table assuming that the Schema agrees with the table structure.
    It does not seem to load an XML file even with W3C namespace and all.
    Krishnaswamy Jayaram

    With XE there is XML support in the database but no XQuery, JNDI, or Servlet support.
    If you give a specific example it could be helpful, here are simple write and read tests on XE;
    HR on 20/03/2006 10:28:22 at XE > CREATE TABLE xml_tab (xmlval XMLTYPE);
    Table created.
    HR on 20/03/2006 10:28:31 at XE > INSERT INTO xml_tab VALUES (
    2 XMLTYPE.CREATEXML(’
    3
    4 221
    5 John
    6 ‘));
    1 row created.
    HR on 20/03/2006 10:28:41 at XE > INSERT INTO xml_tab VALUES (
    2 XMLTYPE.CREATEXML(’
    3
    4 331
    5 PO_1
    6 ‘));
    1 row created.
    HR on 20/03/2006 10:28:49 at XE > select x.xmlval.getstringval() from xml_tab x;
    X.XMLVAL.GETSTRINGVAL()
    221
    John
    331
    PO_1

  • 1.is it possible to read a .xls file and load it into an oracle table

    1.is it possible to read a .xls file and load it into an oracle table, using oracle database or oracle forms i.e. either utl_file, or text_io, or any other oracle tool.
    As far as I know we need a csv file or a txt ( tab delimited) file ?
    2.Are there any windows tools for the same

    Hi,
    If you want to use the DDE package to read the XLS file then yes, you will neeed to know the number of rows and columns in the input file.
    i.e. How will you know :
    1) How many columns are there in the input file.
    If I have a XLS file with the following data :
    R1C1 R1C2 R1C3 R1C4 R1C5 R1C6 R1C7
    xxx xx x
    Where R represents row and C represents column, then how will you know the each row has 7 columns. If you know the answer upfront, then it's not a issue.
    Using the DDE apprach, you will have to specify the RowNum and the ColumnNo of each idividual cells to read/write data from xls sheet.
    Look at the syntax in my ealier post.
    using the other approch (i.e. comma delimited text file - CSV file) , you need not know the number of columns as you can loop thru the input record till the last column is read.
    All you have to do is to look for the 'n' occurances of the field delimiter say ',', do a substr from the current position to the point where the ',' was found.
    This process is to be repeated in a loop till all columns are read.
    The TEXT_IO package can trap for EOF (End Of File).
    Hope I made myself clear.
    -- Shailender Mehta --

  • The size of a XML document stored in a XMLType table

    Is there a way to find out (via SQL) the size of a XML document stored in a XMLType table or XMLType column (storage OR based)?
    For instance in the way you could it retrieve if the XML document was stored in an XMLType column (CLOB based)
    SQL> r
    1 select dbms_lob.getlength(t.gegevens.getclobval()) "SIZE"
    2 from hgo.hgo010_detam t
    3* where rownum < 2
    SIZE
    2750

    Is there a way to find out (via SQL) the size of a XML document stored in a XMLType table or XMLType column (storage OR based)?
    For instance in the way you could it retrieve if the XML document was stored in an XMLType column (CLOB based)
    SQL> r
    1 select dbms_lob.getlength(t.gegevens.getclobval()) "SIZE"
    2 from hgo.hgo010_detam t
    3* where rownum < 2
    SIZE
    2750

  • Uploading data from a xlsx file into an Oracle table

    Hi All,
    I want to know what would be the best approach and tool to upload the data from an xlsx (excel) sheet into an Oracle table.
    Can I use 'sqlldr'?
    ~Parag

    Parag Kalra wrote:
    What if the excel sheet is exported from some other third party database and not explicitly generated on Windows? I know if we can export it to excel why can't we also export it to csv but what if that option is also not available.
    Also what things do I need to take into account when I export a xlsx file to csv file. I mean I hope in no circumstances there would be a data loss.How about instead of of these "what ifs" and "I hopes" you tell us exactly what you have to work with and describe the real business problem. If you ask the wrong questions, you get the wrong answers.
    You "hope" that there would be no data loss? Do you really think Excel would survive as a product, much less be the overwhelming dominant product of its type, if it screwed up something that fundamental? The only thing that will be lost is the formatting meta-data.

  • Writing a stored procedure to import SQL Server table data into a Oracle table

    Hello,
    As a new DBA I have been tasked with writing a stored procedure to import SQL Server table data into an Oracle table. I have been given many suggestions on how to do it from SQL Server but I I just need to write a stored procedure to run it from the Oracle side. Suggestions/guidance on where to start would be greatly appreciated! Thank you!
    I started to write it based on what I have but I know this is not correct :/
    # Here is the select statement for the data source in SQL Server...
    SELECT COMPANY
    ,CUSTOMER
    ,TRANS_TYPE
    ,INVOICE
    ,TRANS_DATE
    ,STATUS
    ,TRAN_AMT
    ,CREDIT_AMT
    ,APPLD_AMT
    ,ADJ_AMT
    ,TRANS_USER1
    ,PROCESS_LEVEL
    ,DESCRIPTION
    ,DUE_DATE
    ,OUR_DATE
    ,OUR_TIME
    ,PROCESS_FLAG
    ,ERROR_DESCRIPTION
      FROM data_source_table_name
    #It loads data into the table in Oracle....   
    Insert into oracle_destination_table_name (
    COMPANY,
    CUSTOMER,
    TRANS_TYPE,
    INVOICE,
    TRANS_DATE,
    STATUS,
    TRANS_AMT,
    CREDIT_AMT,
    APPLD_AMT,
    ADJ_AMT,
    TRANS_USER1,
    PROCESS_LEVEL,
    DESCRIPTION,
    DUE_DATE,
    OUR_DATE,
    OUR_TIME,
    PROCESS_FLAG,
    ERROR_DESCRIPTION)
    END;

    CREATE TABLE statements would have been better as MS-SQL and Oracle don't have the same data types.
    OUR_DATE, OUR_TIME will (most likely) be ONE column in Oracle.
    DATABASE LINK
    Personally, I'd just load the data over a database link:
    insert into oracle_destination_table_name ( <column list> )
    select ... <transform data here>
    from data_source_table@mssql_db_link
    As far as creating the database link from Oracle to MS-SQL ... that is for somebody else to answer.
    (most likely you'll need to use an ODBC driver)
    EXTERNAL TABLE
    If the data from MS-SQL is in a CSV file, just use and external table.
    same concept:
    insert into oracle_destination_table_name ( <column list> )
    select ... <transform data here>
    from data_source_external_table
    MK

  • How to read RMAN data into an ORACLE Table?

    Hallo,
    With regards to RMAN, how should we store the data into a database table, from the commands which can run only on RMAN prompt without using Recovery Catalog?
    For Example:
    RMAN> Report need backup days 3;
    RMAN DATA:
    RMAN-03022: compiling command: report
    Report of files whose recovery needs more than 3 days of archived logs
    File Days Name
    1 1203 D:\ORACLE\ORADATA\TEST\SYSTEM01.DBF
    2 1203 D:\ORACLE\ORADATA\TEST\RBS01.DBF
    3 1203 D:\ORACLE\ORADATA\TEST\USERS01.DBF
    Should it done via UTL_FILE?
    If so, could someone give simple example/code how to do that, in order to write this RMAN data into an Oracle Database table?
    I also set the utl_file_dir parameter to a particular directory in my database.
    Thanks
    W.Benvort

    Actually, I am not using Recovery Catalog, so the views like RC_database, Rc_tablespaces etc , which are specific to recovery catalog are not available.
    r.- this make sense at 100% because those views belong to the recovery catalog.
    So, I wanted that these information, which we can get via using the commands like above, transfer into an Oracle table
    r.- If you want to access the views of the Recovery Catalog to store part of that information in tables you have to have the database registered in a Recovery Catalog.
    Should we keep the Recovery Catalog in Control file? Instead of using separate Schema.
    r.- I recommend you to create a catalog for your database because the space the controlfile to store information regarding RMAN is reused and you can lose important information about your backups.
    Can we run Catrman.sql script as a sys in order to keep the recovery catalog in sys schema?
    r.- As you know, this is not recommended at all.
    Conclusion : Create a Recovery Catalog and you will be able to perform all that you want regardind what you mentioned above.
    I have a thread for this:
    RMAN ( CATALOG CREATION ) STEP BY STEP by Joel Pérez
    Joel Pérez
    http://otn.oracle.com/experts

  • How to associate hardware information into an Oracle Table?

    Hi,
    I am new on Windows 2000 .
    I am using the following script in order to get the windows 2000
    hardware information.
    I am using 8.1.7 version of ORACLE.
    I am using a table "Server Hardware"(Server list,Network Adapter,RAM).
    I would like to ask that how should or where should I use this script
    in order to associate its information into my table "Server Hardware".
    Could someone give me hints that how to use this script?
    Thanks
    Lee
    Following script returns the name and version number of the operating
    system installed on a computer
    Script Code
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer &
    "\root\cimv2")
    Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
    For Each objOperatingSystem in colOperatingSystems
    Wscript.Echo objOperatingSystem.Caption & " " &
    objOperatingSystem.Version
    Next

    Actually, I am not using Recovery Catalog, so the views like RC_database, Rc_tablespaces etc , which are specific to recovery catalog are not available.
    r.- this make sense at 100% because those views belong to the recovery catalog.
    So, I wanted that these information, which we can get via using the commands like above, transfer into an Oracle table
    r.- If you want to access the views of the Recovery Catalog to store part of that information in tables you have to have the database registered in a Recovery Catalog.
    Should we keep the Recovery Catalog in Control file? Instead of using separate Schema.
    r.- I recommend you to create a catalog for your database because the space the controlfile to store information regarding RMAN is reused and you can lose important information about your backups.
    Can we run Catrman.sql script as a sys in order to keep the recovery catalog in sys schema?
    r.- As you know, this is not recommended at all.
    Conclusion : Create a Recovery Catalog and you will be able to perform all that you want regardind what you mentioned above.
    I have a thread for this:
    RMAN ( CATALOG CREATION ) STEP BY STEP by Joel Pérez
    Joel Pérez
    http://otn.oracle.com/experts

  • Insert XML content  from BLS to oracle table

    Hi,
    Is there any way to send XML content from BLS to Oracle table. I tried with FixedQueryWithOuput. It works, but it has limitation, it cannot take more than 4000 character , even though the param is configured as clob in oracle database side?

    Sajjad
    This is not issue from xMII-side itself, instead this is an Oracle issue itself. This has some limitation in manipulating data in Database.
    Managing CLOBs and BLOBs in JDBC is not very simple when compared to managing small amount of data. The way the CLOB and the BLOB objects are created and managed is different than a VARCHAR(String) column. In fact, Oracle extension classes are provided to support these types objects in JDBC like oracle.sql.CLOB, oracle.sql.BLOB etc.
    The new enhancements in Oracle JDBC 10g promises to simplify the insertion and retrieval techniques for the CLOBs using the standard APIs. This document enumerates how easily the CLOB data can be handled in JDBC, by harnessing the new features of the Oracle JDBC 10g driver
    Anyway, to more get info on Oracle problems u may read  <a href="http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/clob10g/handlingclobsinoraclejdbc10g.html">this</a>
    Regards
    Som

  • How can I inserting file's line into a oracle table in physycal order

    How can I insert the file's line into a oracle table in the same physycal order that they exists in the file ?
    I am using "SQL to FILE" km to performing file load into Oracle table, but the order which the records are insered into the oracle table doesn't match with the order of file's lines
    How can I guarantee the same file's physycal order in the oracle table( target ) and file( source ) ?
    Is it possible throught ODI ?
    Thanks,
    Luciana

    Hi,
    although I understand why use "File to Oracle( SQLLDR )" KM, I haven't the guarantee that in the agent's machine the Oracle Client installed and because when I openned the others projects I saw that anyone in my company use this KM( "File to Oracle( SQLLDR )" )
    Tha's why I ask for anyone lead me whith the modification of the previous post in the "uLKM File to SQL", specifing the km step e where put the RECNUM pseudo column
    This is fundamental for my ODI project
    When I try to alter the "Create Work Table" and "Load Data" step of my "uLKM File to SQL" km, the execution returned me the error below:
    =====================> Create Work Table Step
    create table <@= vWorkTable @>
         C1_LINHA_ARQ     VARCHAR2(500) NULL, RECNUM NUMBER(10)
    =====================> Load Data Step
    select     LINHA_ARQ     C1_LINHA_ARQ
    from      TABLE
    /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=ARQ_INSS2SNP$CRLOAD_FILE=/arquivos_odi/ccrs/in/#CCRS_CAD_INSS.vpNOME_ARQUIVOSNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=09SNP$CRFILE_SEP_LINE=0D0ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=LINHA_ARQSNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLINE_OFFSET=1SNP$CRLENGTH=500SNP$CRPRECISION=500SNP$CR$$SNPS_END_KEY*/
    insert into ODI_RUN_CONV.C$_0TMP_ODI_INSS_DADOS_ARQ
         C1_LINHA_ARQ, RECNUM
    values
         :C1_LINHA_ARQ, RECNUM
    =====================
    984 : 42000 : java.sql.BatchUpdateException: ORA-00984: column not allowed here
    984 : 42000 : java.sql.SQLSyntaxErrorException: ORA-00984: column not allowed here
    java.sql.BatchUpdateException: ORA-00984: column not allowed here
         at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:629)
         at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9409)
         at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:211)
         at com.sunopsis.sql.SnpsQuery.executeBatch(Unknown Source)
    ...Thanks again gyus,
    Luciana
    Edited by: 933810 on 31/05/2012 06:04
    Edited by: 933810 on 31/05/2012 06:07
    Edited by: 933810 on 31/05/2012 06:14

  • How to load the data from .csv file to oracle table???

    Hi,
    I am using oracle 10g , plsql developer. Can anyone help me in how to load the data from .csv file to oracle table. The table is already created with the required columns. The .csv file is having about 10lakh records. Is it possible to load 10lakh records. can any one please tell me how to proceed.
    Thanks in advance

    981145 wrote:
    Can you tell more about sql * loader??? how to know that utility is available for me or not??? I am using oracle 10g database and plsql developer???SQL*Loader is part of the Oracle client. If you have a developer installation you should normally have it on your client.
    the command is
    sqlldrType it and see if you have it installed.
    Have a look also at the FAQ link posted by Marwin.
    There are plenty of examples also on the web.
    Regards.
    Al

Maybe you are looking for

  • HR ABAP report

    Hello, I am writing a bespoke HR ABAP report. I am using logical database PNP for this. I also need to include the Scale Proficiency Text in my report. I have had a look at the SAP standard Qualifications Overview report and I can see that this uses

  • IPad mirror shows up in 4:3 aspect

    why doesn't apple tv show ipad mirror in widescreen and only in 4:3 aspect ratio - the advertisements clearly show photos in full screen - am I missing something or is this misleading advertising

  • No Return delivery

    Hi all I am facing problem while doing return delivery. The GR is done for material and it got posted to quality inspection. There due to poor quality , it is moved to blocked stock. Invoice is posted. Now i want to return to vendor, while doing retu

  • Scatter Chart with different markers

    Hello, I am using APEX4.0, i want to create a scatter chart with multiple Series, How i can associate differents Marker for Series ?????? For example (Cercle for Serie1, rectangle for Series2 , ....etc). Regards. ouadah.

  • Photoshop CS4 and iMac(ATI 4850) Open GL problem?

    Hi: My problem is; when I click full screen mode with menu bar options(Shortcut is F) my workshop background grey area has a colorfull noise and lines(Randomly). My machine and graphic card compatible with Open GL. Anyone know why did happen like tha