Use of PL/SQL to populate table columns from XML data file

I'm trying to find the easiest way to transfer data from a flat file that is in XML format into a traditional Oracle table. Not retaining the XML but actually map an XML element to a column so standard SQL, Forms, Reports, etc can access like it was created using a Form.
Example: Table A has column names Tom, Dick and Harry and the XML file has elements Tom, Dick and Harry and I just want a function that maps and inserts/loads the data into Table As individual columns.
The process needs to be easily initiated by an end user. The user gets the XML data file via an email attachment and needs to do something like a Concurrent Request to pull in the file and load it. Using PL/SQL would be great.
I appreciate any help that can be provided.

Hi,
HELP!!!!!
We are having the same problem and we are using oracle 10ir2.
We create an object type (sql type globally not in a package):
CREATE OR REPLACE TYPE G_EX AS OBJECT
( EX_ID NUMBER ,
EX_CON VARCHAR2 ( 100 ) ,
EX_L VARCHAR2 ( 30 ) ,
EX_T VARCHAR2 ( 4000 ) );
CREATE OR REPLACE TYPE G_EX LIST AS TABLE OF  GEX AS ;
then we insert data through a bulk collect within the package with the table declared of this array of object types:
v_table G_EX _LIST:= NULL;
SELECT G_EX (ex_id
,ex_con
,ex_l
,ex_t )
BULK COLLECT INTO v_table
FROM exs_lookup;
I am using the syntax (below) but it gives PL/SQL: ORA-00902: invalid datatype
sometimes not always:
SELECT G_EX ( ex_id
,ex_con
,ex_l
,ex_t )
BULK INTO v_data_record
FROM TABLE (v_table)
WHERE ex_id = p_key;
where p_key - is a number type
and v_data_record is a G_EX object type.
I was wondering if anyone else encountered a similar problem, and knows what we may have done wrong. Since we dont understand why this piece of code is throwing this ora-00902 errors occasionally not always.
Also, if we restart the database up once this errors occurs it appears to stop throwing this ora_00902 error for a lenght of time. Then it comes up with the ora-00902 error again (why?)
thanks

Similar Messages

  • How to use XML data stored in table column in XML Data Definition

    Hi,
    We are using BIP 5.6.3 (Oracle EBS R12).
    We have a table which stores XML data in a column. Is there a way we can use this XML data through a SQL query in XML Data Definition of BI Publisher report instead or writing whole SQL query to fetch same data from Oracle EBS?
    Can some please provide a sample SQL query that we should use in Data Definition?
    Thanks!

    Mark,
    Thanks. This is exactly what I was looking for.
    After doing @Name in both places (SELECT and WHERE clause) it worked.
    Now I have one more question.
    There are multiple DIMENSION tags in my xml, and I want to see the NAME attribute values for all of those DIMENSIONs. The following query returns
    ORA-19025: EXTRACTVALUE returns value of only one node.
    Cause: Given XPath points to more than one node.
    Action: Rewrite the query so that exactly one node is returned.
    SELECT
    extractValue(value(x), '/AW/@Name') as "AW",
    extractValue(value(x), '/AW/Dimension/@Name') as "DIMENSIONS"
    from
    OLAP_AW_PRC,
    table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
    where
    extractValue(value(x) , '/AW/@Name') = 'OMCR4'

  • Using FGA in Oracle 9i on tables that store XML data

    Hello,
    Our company wishes to use FGA policies to log transaction data for updates that take place in our software (Web based software using Oracle 9i Enterprise Edition (9.2.0.6.0))
    This is working just great for logging transaction information on all of our tables except for those that hold XML data. It seems that the XML code is causing an error as it attempts to write in to an audit entry. I have requested information on the specific errors that are being generated, and do not have the exact messages to post yet - but I was hoping that someone out here could comment on FGA and XML data logging, if this is even possible in 9i, or if particular add-ons or updates may need to be made to the database before this can be expected to function as desired.
    Thank you in advance,
    Sabrina Goodpaster
    Database / Configuration Management Specialist
    ENVISAGE Technologies, Corp.
    1441 S. Fenbrook Lane
    Bloomington, IN 47401

    Is the intent to audit tables containing XML or to audit changes to the XML? There is a huge difference.
    Also, working in software as older than my car isn't helping you. How about applying a few patches or upgrading to something supported?

  • SQL*Loader . A column value in data file contains comma(,)

    Hi Friends,
    I am getting an issue while loading a csv file to database.
    A column in datafile contains a comma .. how to load such data?
    For ex, a record in data file is :
    453,1,452,N,5/18/2006,1,"FOREIGN, NON US$ CORPORATE",,,310
    Here "FOREIGN, NON US$ CORPORATE" is a column and contains a , in the value.
    I have specified optionally enclosed with " also.. but still not working
    Here is my control file:
    options (errors=100)
    load data
    infile 'TAX_LOT_DIM_1.csv'
    badfile 'TAX_LOT_DIM_1.bad'
    replace
    into table TAX_LOT_DIM
    fields terminated by ',' optionally enclosed by '"'
    trailing nullcols
    TAX_LOT_DIM_ID ,
    TAX_LOT_NBR ,
    TAX_LOT_ODS_ID ,
    RESTRICTION_IND ,
    LAST_UPDATE_DTM ,
    TRAN_LOT_NBR integer,
    MGR_GRP_CD optionally enclosed by '"' ,
    RESTRICTION_AMT "TO_NUMBER(:RESTRICTION_AMT,'99999999999999999999.999999999999')" ,
    RESTRICTION_INFO ,
    SRC_MGR_GRP_CD
    Problem is with MGR_GRP_CD column in ctrl file.
    Please reply asap.
    Regards,
    Kishore

    Thanks for the response.
    Actually my ctrl file is like this with some conversion functions:
    replace
    into table TAX_LOT_DIM
    fields terminated by ',' optionally enclosed by '"'
    trailing nullcols
    TAX_LOT_DIM_ID "TO_NUMBER(:TAX_LOT_DIM_ID ,'999999999999999.99999999')",
    TAX_LOT_NBR ,
    TAX_LOT_ODS_ID "to_number(:TAX_LOT_ODS_ID ,'999999999999999.999999')",
    RESTRICTION_IND ,
    LAST_UPDATE_DTM "to_date(:LAST_UPDATE_DTM ,'mm/dd/yyyy')",
    TRAN_LOT_NBR integer, --"TO_NUMBER(:TRAN_LOT_NBR,'999999999999999.99999999999999999')",
    MGR_GRP_CD char optionally enclosed by '"' ,
    RESTRICTION_AMT "TO_NUMBER(:RESTRICTION_AMT,'99999999999999999999.999999999999')" ,
    RESTRICTION_INFO ,
    SRC_MGR_GRP_CD
    For char columns , even i dont give any datatype, i think it will work.
    And pblm is not with this hopefully.
    Thanks,
    Kishore

  • SQL*Loader - How to load only a few columns from a .csv file to ora table

    Hi there,
    Could anyone please let me know how to load few columns from a .csv
    file into a oracle table using SQL*Loader.
    I know how to create a .dat and .ctl file and run the sql loader.
    Suppose I have a .csv file with
    col1, col2, col3, col4
    and I only need to load col1 and col3 into col_a and col_b respectively
    in table_a?
    structure of table_ a
    col_a,
    col_b
    Please advice

    Try like..it i will work..
    LOAD DATA
    INFILE 'test.txt'
    LOAD DATA
    TRUNCATE INTO TABLE T1
    FIELDS TERMINATED BY ','
    (col1,
    col2 FILLER,
    col3,
    col4 FILLER
    )

  • Read a Column from an Excel file

    Guys,
    Is there a way I can read a specific column from an excel file, use that data to query and select data from a table and then insert the output into another column of that same excel file.
    Please advise! Thanks

    > Is there a way I can read a specific column from an excel file, use that data to query and select data from a
    table and then insert the output into another column of that same excel file.
    Not easily. An Excel file is typically in a proprietary binary file format. Perhaps saved using the new MS Office XML format.. which would be possible to process via Oracle's XDB.
    But assuming it is in a binary format, you need "something else" to read and parse that file for you - like ODBC or DDE or COM/DCOM, etc.
    Oracle supports Heterogeneous Database Services. On a Windows Server, you can create a database link in Oracle that uses an ODBC driver to connect to an ODBC data source. There are ODBC drivers for Excel. However, this requires the data in the worksheet to be properly marked as a data table. Or did last time I looked at it about 2 years ago.
    You can also call external "interfaces" from PL/SQL using EXTPROC - such interfaces can be DLLs. Which means you do have access to the Win32 API and application APIs from PL/SQL. This can be used to access the content of an Excel file - DDE for example can quite easily do this (you use it to peek the contents of an Excel grid location), but requires Excel to be running and that spreadsheet to be loaded. DDE can also be used to poke contents (write something back to a cell in a spreadsheet).
    But using Oracle code to use an Excel file as a kind of database file... that IMO does not make a lot of sense. At all.

  • How to Find what are tables and "Table Name" in particular "Data File"

    hi Team,
    I have one database that database 300 gb size , this database having 6 ndf files ,
    here How to Find  what are the tables and  "Table Name"  in particular "Data File"[.ndf]

    Hi,
    In addition to Prashanth’s suggestion, you can also use the following Transact-SQL statements to get more detailed information including  all objects and indexes per Filegroup / Partition and allocated data size of databases.
    The script can work with Microsoft SQL Server 2005 and higher version in all Editions. For more details, please review this article:
    List all Objects and Indexes per Filegroup / Partition.
    -- List all Objects and Indexes
    -- per Filegroup / Partition and Allocation Type
    -- including the allocated data size
    SELECT DS.name AS DataSpaceName
    ,AU.type_desc AS AllocationDesc
    ,AU.total_pages / 128 AS TotalSizeMB
    ,AU.used_pages / 128 AS UsedSizeMB
    ,AU.data_pages / 128 AS DataSizeMB
    ,SCH.name AS SchemaName
    ,OBJ.type_desc AS ObjectType
    ,OBJ.name AS ObjectName
    ,IDX.type_desc AS IndexType
    ,IDX.name AS IndexName
    FROM sys.data_spaces AS DS
    INNER JOIN sys.allocation_units AS AU
    ON DS.data_space_id = AU.data_space_id
    INNER JOIN sys.partitions AS PA
    ON (AU.type IN (1, 3)
    AND AU.container_id = PA.hobt_id)
    OR
    (AU.type = 2
    AND AU.container_id = PA.partition_id)
    INNER JOIN sys.objects AS OBJ
    ON PA.object_id = OBJ.object_id
    INNER JOIN sys.schemas AS SCH
    ON OBJ.schema_id = SCH.schema_id
    LEFT JOIN sys.indexes AS IDX
    ON PA.object_id = IDX.object_id
    AND PA.index_id = IDX.index_id
    WHERE OBJ.type_desc='USER_TABLE'-- add this WHERE clause to display the information of user tables
    ORDER BY DS.name
    ,SCH.name
    ,OBJ.name
    ,IDX.name
    Thanks,
    Lydia Zhang

  • Java.sql.SQLException: ORA-01157: cannot identify/lock data file : PLz Help

    My datafiles are in ASM file system, however the only one file ACIPEN_DATA is the one, which is not in ASM file system, and this the file which is in concern.
    We are getting the following exception in the lxkratgas1.lex1.lexmark.com when connecting to ACIPEN_DATA.
    This exception is coming up sometimes and the sometimes the file is getting processed successfully
    Caused by: java.sql.SQLException: ORA-01157: cannot identify/lock data file 9 - see DBWR trace file
    ORA-01110: data file 9: '/oracle/SE/product/10.2.0/db_1/dbs/ACIPEN_DATA'
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1169)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
    at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:278)
    at atg.adapter.gsa.SQLStatement.executeUpdate(SQLStatement.java:725)
    at atg.adapter.gsa.Table.insert(Table.java:1378)
    at atg.adapter.gsa.GSAItemDescriptor.addItem(GSAItemDescriptor.java:6272)
    ... 61 more
    ====================================================================
    We have checked the datafile, it is absolutely online.
    Can some expert jump in and resolve this issue Please.

    01157, 00000, "cannot identify/lock data file %s - see DBWR trace file"
    // *Cause:  The background process was either unable to find one of the data
    //         files or failed to lock it because the file was already in use.
    //         The database will prohibit access to this file but other files will
    //         be unaffected. However the first instance to open the database will
    //         need to access all online data files. Accompanying error from the
    //         operating system describes why the file could not be identified.
    // *Action: Have operating system make file available to database. Then either
    //         open the database or do ALTER SYSTEM CHECK DATAFILES.is this a RAC database?

  • HELP ME! Creating a table from a data file

    Hi
    I'm writing an application for data visualization. The user can press the "open file" button and a FileChooser window will come up where the user can select any data file. I would like to take that data file and display it as a table with rows and columns. The user needs to be able to select the coliumns to create a graph. I have tried many ways to create a table, but nothing seems to work! Can anyone help me?! I just want to read from the data file and create a spreadsheet type table... I won't know how many rows and columns I'll need in advance, so the table needs to be dynamic!
    If you have ANY tips, I'd REALLY appreciated.....

    I won't know how many rows and columns I'll need in advance, so the table needs to be dynamic!You may use a List (ArrayList, LinkedList or Vector) for that.
    Lists allow you (dynamically) add elements.

  • How to avoid duplicate data while inserting from sample.dat file to table

    Hi Guys,
    We have issue with duplicate data in flat file while loading data from sample.dat file to table. How to avoid duplicate data in control file.
    Can any one help me on this.
    Thanks in advance!
    Regards,
    LKR

    No, a control file will not remove duplicate data.
    You would be better to use an external table and then remove duplicate data using SQL as you query the data to insert it to your destination table.

  • Populate PDF form with XML data

    Although a seemingly simple task, this question has occupied way too much of my time the last week and I am asking the following out of sheer desperation and frustration.
    I have a pdf form created with Designer 7.0. I have a separate XML data file to populate the form with. I can test using the preview in Designer and everything looks great. Now, all I want to do is deploy this pdf to a standard web server (IIS, Windows) such that any visitor to the site (using Reader) is able to open it/view it/print it, with the data there. That's it.
    This was easily accomplished using Acrobat 6 by creating an ASP page that output an FDF file which referenced the PDF. Not so with the latest version.
    I have downloaded three separate several hundred page documents that do not explain how to accomplish this task simply. So to summarize:
    1. Does this task *require* a separate piece of software (Document Server) that was not required before?
    2. If Document Server is not required, what are the steps to publish the pdf file and reference the data file?
    Please help, extraordinarily frustrated :-(.

    Ravinder, were you actually able to get your PDF Document (Form) to load with data?  I have not been able to get my .NET page to populate my PDF document - the PDF loads in my Browser but has no data.  If you can post sample code that you were able to get to work, it would be appreciated, or if you notice something wrong with my code below, please let me know.<br /><br />Also, when my PDF document loads in my browser, I am prompted to "Open or Save" my .xdp file and if I click "Open", my PDF Form loads, but the fields are not populated.  How do I stop this prompt from loading?  I don't want the user(s) to be able to see this.<br /><br />My .NET page and XML file are listed below:<br />------------------------- .NET -----------------------------------<br />Imports System.Text<br />Imports System.IO<br /><br />Public Class WebForm1<br />    Inherits System.Web.UI.Page<br /><br />#Region " Web Form Designer Generated Code "<br /><br />    'This call is required by the Web Form Designer.<br />    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()<br /><br />    End Sub<br /><br />    'NOTE: The following placeholder declaration is required by the Web Form Designer.<br />    'Do not delete or move it.<br />    Private designerPlaceholderDeclaration As System.Object<br /><br />    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init<br />        'CODEGEN: This method call is required by the Web Form Designer<br />        'Do not modify it using the code editor.<br />        InitializeComponent()<br />    End Sub<br /><br />#End Region<br /><br />    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />        'Put user code to initialize the page here<br /><br />        Dim responseString As New StringBuilder<br />        Dim sr As StreamReader<br />        Dim xmldata As String<br /><br />        Response.ContentType = "application/vnd.adobe.xdp+xml"<br />        responseString.Append("<?xml version='1.0' encoding='UTF-8'?>")<br />        responseString.Append("<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.0'?>")<br />        responseString.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>")<br />        responseString.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>")<br />        responseString.Append("<xfa:data xfa:dataNode='dataGroup'>")<br />        sr = File.OpenText("c:\\inetpub\\wwwroot\\PDFFiller\\TestForm_data.xml")<br />        xmldata = sr.ReadToEnd()<br />        sr.Close()<br />        responseString.Append(xmldata)<br /><br />        'responseString.Append("<form1>")<br />        'responseString.Append("<txtFirstName>Homer</txtFirstName>")<br />        'responseString.Append("<txtLastName>Simpson</txtLastName>")<br />        'responseString.Append("</form1>")<br /><br />        responseString.Append("</xfa:data>")<br />        responseString.Append("</xfa:datasets>")<br />        responseString.Append("<pdf href='http://localhost/PDFFiller/TestForm.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />")<br />        responseString.Append("<xfdf xmlns='http://ns.adobe.com/xfdf/' xml:space='preserve'>")<br />        responseString.Append("<annots/>")<br />        responseString.Append("</xfdf>")<br />        responseString.Append("</xdp:xdp>")<br /><br />        Response.Write(responseString)<br />        Response.Flush()<br />        Response.End()<br /><br />    End Sub<br /><br />End Class<br /><br />----------------------End .NET -----------------------------------<br /><br />--------- XML (TestForm_data.xml) --------------------------------<br /><form1><txtFirstName>Homer</txtFirstName><txtLastName>Simpson</txtLastName></form1><br />----------------------End XML -----------------------------------

  • Java.sql.SQLException: ORA-01157: cannot identify/lock data file 7 - see DB

    I am deploying my application components on Oracle RAC database, when i install my app component i will run a script which creates a user and tablespace on bot rac-nodes(node1 and node2)
    as database is clustered, the user are created on 2 nodes and tablespace is stored in a shared location for two rac nodes
    i am able to successfully run my script on rac-node1 and and installed my component and when i started installing the app component on node2 getting error
    java.sql.SQLException: ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
    ORA-01110: data file 7: '/db/db/db/ora10g/10.2.0/admin/dbadmin_01.dbf'
    ORA-06512: at "ADMIN.XL_SP_DBCHECK", line 48
    ORA-06512: at line 1
    "dbadmin_01.dbf is the custom tablespace which created by me"
    i a mgetting error while installing the app component on rac-node2

    You should not create database files outside of the ASM.
    I'm not sure you can move the datafile, I would export the data from the tablespace (if there is data you need there), delete the tablespace and recreate it in the ASM, then import the data back.
    If you want to move the datafile, you can try using RMAN (from node1).
    First connect to the database with sqlplus and execute:
    alter tablespace <tbs_name> offline;Then start RMAN: rman target /
    BACKUP AS COPY DATAFILE '<file>' FORMAT '+<ASM_DG>';Then in sqlplus, execute:
    alter tablespace <tbs_name> online;I'm not sure it will work, and I hope I got the commands right because I can't check it right now.
    Good luck
    Liron Amitzi
    Senior DBA consultant
    [www.dbsnaps.com]
    [www.orbiumsoftware.com]

  • PL/SQL Package importing from Flat Data files

    Looking for sample PL/SQL package in importing data from flat data files into Oracle. Possible using the UTL_FILE.FOPEN and UTL_FILE.GET_LINE functions ?

    SQL Loader is tailor-made for importing data from flat-files.
    There's way less code to write and it is usually faster than coded approach so this may be better solution for you, depending on details of your situation.
    See docs: http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a76955/ch03.htm#2436

  • I can't use thunderbird 31.2.0 to send attachement from a pdf file with Acrobat PRO XI

    I can't use thunderbird 31.2.0 (Mozilla) to send attachement from a pdf file with Acrobat PRO XI. Each time, Acrobat replies (in french) : "il n'y a pas de client pour la messagerie par défaut". Thunderbird is indicated as "by default" in the list of programs of Windows.
    Even if I type my e-mail address, etc. in the account of Acrobat, it doesn't change. Each time, I have to record a PDF file in a folder and return to Thunderbird to send it as attached. It is a too long process,  compared with Windows XP with Acrobat Reader or Acrobat 5, I had before.
    Would you please help me to explain the process. My OS is Windows 8.1.
    Thank you

    Thank you for your answer.
    What i want to do : to send PDF files as attached documents in a message
    generated by thunderbird by my e-mail address [email protected] or
    another one I have.
    When I introduce my e-mail address under Edit-Preferences-Email
    Accounts, Acrobat ask the e-mail account, the password, the IMAP for
    ingoing message (and I use POP) and SMTP for outgoing messages. Even I
    introduce all the datas, it doesn't change, Acrobat is unable to send
    the message. And the process is not convenient, because I need all my
    outgoing messages be documented inside Thunderbird.
    So, I repeat my request : how can I use thenderbird as program by
    default from Acrobat or any other software ?
    Thank you for your next message.
    Jean-Luc Rongé
    Le 21-10-14 14:24, ANAND8502 a écrit :
    >
          I can't use thunderbird 31.2.0 to send attachement from a pdf
          file with Acrobat PRO XI
    created by ANAND8502 <https://forums.adobe.com/people/ANAND8502> in
    /Acrobat Installation & Update Issues/ - View the full discussion
    <https://forums.adobe.com/message/6850947#6850947>

  • Master details tables and no xml data source

    Hello
    I want to create mater - details tables where details table will be repeated for each master row.
    So i created master table and placed detail table into master table cell.
    so what i want to have
    product1 quantity
                              - item1
                              - item2
    product2 quantity
                              - item3
                              - item3
    for now i have
    product1 quantity
                             - item1
                             - item2
                             - item3
                             - item3
    product2 quantity
    here is how i fill the table
    for i in 1..5 do
                ("Cell1r", "quantity" + i.ToString())
                ("Cell2r", "product" + i.ToString())           
            ] |>p
            for j in 1..2 do
                        ("Cell11", "product" + i.ToString())
                        ("Cell21", "serial" + j.ToString())
                        ("Cell31", "function" + j.ToString())
                    ]|>p
    i found an axample how to do it from xml data sourcem but have no idea and did not find how  to do it manualy(when i bing by name from code dynamicaly)

    i found hot to do it with xml source
    http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=000241.html
    but how to do it manualy ?

Maybe you are looking for