Read XML file into databased using stored procedure

I need to read an xml file into my database using a stored procedure. I looked at a couple of tutorials, but I am kind of lost and am looking for some guidance. I will eventually need to only pull a handfull of the data in based on the USER ID. Any help will be greatly appreciated. I have been given a schema file and an example file of how the data will me sent to me. The schema file is below:
<h1>Schema File</h1>
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by Turbo XML 2.4.1.100. Conforms to w3c http://www.w3.org/2001/XMLSchema-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:element name="root">
<xsd:complexType />
</xsd:element>
<xsd:element name="Report">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Biller" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Biller">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="BillerName" />
<xsd:element ref="BillerIdNumber" />
<xsd:element ref="PartnerInfo" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="BillerName">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="BillerIdNumber">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="PartnerInfo">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="PartnerName" />
<xsd:element ref="PartnerVenderNumber" />
<xsd:element ref="PartnerStreet01" />
<xsd:element ref="PartnerStreet02" />
<xsd:element ref="PartnerCity" />
<xsd:element ref="PartnerState" />
<xsd:element ref="PartnerZip" />
<xsd:element ref="PartnerCountry" />
<xsd:element ref="PartnerActive" />
<xsd:element ref="PartnerContactName" />
<xsd:element ref="PartnerEmailAddress" />
<xsd:element ref="PartnerContactPhone" />
<xsd:element ref="PartnerFaxNumber" />
<xsd:element ref="PartnerUpdateUser" />
<xsd:element ref="PartnerUpdateDate" />
<xsd:element ref="PartnerDocColor" />
<xsd:element ref="PartnerDocDistribution" />
<xsd:element ref="PartnerDocPrinting" />
<xsd:element ref="PartnerDocTiming" />
<xsd:element ref="Delivery" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="PartnerName">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="PartnerVenderNumber">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="PartnerStreet01">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerStreet02">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerCity">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerState">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerZip">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerCountry">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerActive">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerContactName">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerEmailAddress">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerContactPhone">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerFaxNumber">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerUpdateUser">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerUpdateDate">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerDocColor">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerDocDistribution">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerDocPrinting">
<xsd:complexType />
</xsd:element>
<xsd:element name="PartnerDocTiming">
<xsd:complexType />
</xsd:element>
<xsd:element name="Delivery">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="DeliveryType" />
<xsd:element ref="DeliveryContactName" />
<xsd:choice>
<xsd:element ref="ReceivingStreet01" />
<xsd:element ref="ReceivingStreet02" />
<xsd:element ref="ReceivingCity" />
<xsd:element ref="ReceivingState" />
<xsd:element ref="ReceivingZip" />
<xsd:element ref="ReceivingCountry" />
<xsd:element ref="DeliveryEmailAddress" />
<xsd:element ref="DeliveryCompanyId" />
<xsd:element ref="DeliveryUserId" />
<xsd:element ref="DeliveryFormatType" />
<xsd:element ref="SecureType" />
<xsd:element ref="SecureQuestion" />
<xsd:element ref="SecureAnswer" />
<xsd:element ref="DeliveryFaxNumber" />
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DeliveryType">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="DeliveryContactName">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="DeliveryEmailAddress">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="SecureType">
<xsd:complexType />
</xsd:element>
<xsd:element name="SecureQuestion">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="SecureAnswer">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="DeliveryFormatType">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="DeliveryCompanyId">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="DeliveryUserId">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="DeliveryFaxNumber">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="ReceivingStreet01">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="ReceivingStreet02">
<xsd:complexType />
</xsd:element>
<xsd:element name="ReceivingCity">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="ReceivingState">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="ReceivingZip">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
<xsd:element name="ReceivingCountry">
<xsd:complexType mixed="true">
<xsd:choice />
</xsd:complexType>
</xsd:element>
</xsd:schema>
<h1>Example File</h1>
<?xml version="1.0" encoding="utf-8"?>
<Report>
<Biller>
<BillerName>DONATO TEST BILLER</BillerName>
<BillerIdNumber>999999999</BillerIdNumber>
<PartnerInfo>
<PartnerName>TEST TRADING PARTNER</PartnerName>
<PartnerVenderNumber>999999999</PartnerVenderNumber>
<PartnerStreet01 />
<PartnerStreet02 />
<PartnerCity />
<PartnerState />
<PartnerZip />
<PartnerCountry />
<PartnerActive />
<PartnerContactName />
<PartnerEmailAddress />
<PartnerContactPhone />
<PartnerFaxNumber />
<PartnerUpdateUser />
<PartnerUpdateDate />
<PartnerDocColor />
<PartnerDocDistribution />
<PartnerDocPrinting />
<PartnerDocTiming />
<Delivery>
<DeliveryType>EMAIL</DeliveryType>
<DeliveryContactName>Kiran</DeliveryContactName>
<DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
</Delivery>
<Delivery>
<DeliveryType>SECURE</DeliveryType>
<DeliveryContactName />
<DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
<SecureType />
<SecureQuestion>Pet Name</SecureQuestion>
<SecureAnswer>040698de9bf14ef87d8cbaf46b8ecddc</SecureAnswer>
<DeliveryFormatType />
</Delivery>
<Delivery>
<DeliveryType>CEO</DeliveryType>
<DeliveryContactName />
<DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
<DeliveryCompanyId>WFADM618</DeliveryCompanyId>
<DeliveryUserId>PAULSEN</DeliveryUserId>
<DeliveryFormatType />
</Delivery>
<Delivery>
<DeliveryType>FAX</DeliveryType>
<DeliveryContactName>Kiran</DeliveryContactName>
<DeliveryFaxNumber>4807244340</DeliveryFaxNumber>
<DeliveryFormatType>PDF</DeliveryFormatType>
</Delivery>
<Delivery>
<DeliveryType>DOC</DeliveryType>
<DeliveryContactName />
<ReceivingStreet01>2600 South Price Road</ReceivingStreet01>
<ReceivingStreet02 />
<ReceivingCity>Chandler</ReceivingCity>
<ReceivingState>AZ</ReceivingState>
<ReceivingZip>85248</ReceivingZip>
<ReceivingCountry>United States</ReceivingCountry>
</Delivery>
<Delivery>
<DeliveryType>DR</DeliveryType>
<DeliveryContactName />
<DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
<DeliveryCompanyId>WFADM618</DeliveryCompanyId>
<DeliveryUserId>PAULSEN</DeliveryUserId>
<DeliveryFormatType />
</Delivery>
</PartnerInfo>
</Biller>
</Report>

Try with a XMLTABLE function
For example to Extract BillerName and BillerID
with t as(select xmltype( '<?xml version="1.0" encoding="utf-8"?>
<Report>
<Biller>
<BillerName>DONATO TEST BILLER</BillerName>
<BillerIdNumber>999999999</BillerIdNumber>
<PartnerInfo>
<PartnerName>TEST TRADING PARTNER</PartnerName>
<PartnerVenderNumber>999999999</PartnerVenderNumber>
<PartnerStreet01 />
<PartnerStreet02 />
<PartnerCity />
<PartnerState />
<PartnerZip />
<PartnerCountry />
<PartnerActive />
<PartnerContactName />
<PartnerEmailAddress />
<PartnerContactPhone />
<PartnerFaxNumber />
<PartnerUpdateUser />
<PartnerUpdateDate />
<PartnerDocColor />
<PartnerDocDistribution />
<PartnerDocPrinting />
<PartnerDocTiming />
<Delivery>
<DeliveryType>EMAIL</DeliveryType>
<DeliveryContactName>Kiran</DeliveryContactName>
<DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
</Delivery>
<Delivery>
<DeliveryType>SECURE</DeliveryType>
<DeliveryContactName />
<DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
<SecureType />
<SecureQuestion>Pet Name</SecureQuestion>
<SecureAnswer>040698de9bf14ef87d8cbaf46b8ecddc</SecureAnswer>
<DeliveryFormatType />
</Delivery>
<Delivery>
<DeliveryType>CEO</DeliveryType>
<DeliveryContactName />
<DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
<DeliveryCompanyId>WFADM618</DeliveryCompanyId>
<DeliveryUserId>PAULSEN</DeliveryUserId>
<DeliveryFormatType />
</Delivery>
<Delivery>
<DeliveryType>FAX</DeliveryType>
<DeliveryContactName>Kiran</DeliveryContactName>
<DeliveryFaxNumber>4807244340</DeliveryFaxNumber>
<DeliveryFormatType>PDF</DeliveryFormatType>
</Delivery>
<Delivery>
<DeliveryType>DOC</DeliveryType>
<DeliveryContactName />
<ReceivingStreet01>2600 South Price Road</ReceivingStreet01>
<ReceivingStreet02 />
<ReceivingCity>Chandler</ReceivingCity>
<ReceivingState>AZ</ReceivingState>
<ReceivingZip>85248</ReceivingZip>
<ReceivingCountry>United States</ReceivingCountry>
</Delivery>
<Delivery>
<DeliveryType>DR</DeliveryType>
<DeliveryContactName />
<DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
<DeliveryCompanyId>WFADM618</DeliveryCompanyId>
<DeliveryUserId>PAULSEN</DeliveryUserId>
<DeliveryFormatType />
</Delivery>
</PartnerInfo>
</Biller>
</Report>')xml from dual)
select q.* from t,xmltable('/Report' passing t.xml columns
BillerName varchar2(20) PATH
                      '/Report//Biller/BillerName')q
        BILLERNAME     BILLERID
     DONATO TEST BILLER     999999999

Similar Messages

  • Loading XML files into Database table

    Loading XML files into Database table
    Hi I have some XML files say 100 files in a virtual directory created using &quot;Create or replace directory command&quot; and those files need to be loaded into a table having a column of XMLTYPE. 1)How to load that using Oracle provided procedures/packages

    Check out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
    Ben

  • Convert XML file into DTD using Java

    Hi All,
    I want to do convert the xml file into DTD using Java.
    I read the DOM package but didnt get clear idea.
    Anyone of you have an idea please share the coding with me.
    Any suggestions greatly appreciated.
    Thanks
    Veera

    Hi All,
    I want to do convert the xml file into DTD using Java.
    I read the DOM package but didnt get clear idea.
    Anyone of you have an idea please share the coding with me.
    Any suggestions greatly appreciated.
    Thanks
    Veera

  • Read XML file into stored procedure

    hi to all, i have this stored procedure :
    create or replace
    PROCEDURE INSERTXML(
                                          p_xml_in CLOB,
                                          p_table IN VARCHAR2 ) AS                                     
      insCtx DBMS_XMLStore.ctxType;
      v_rows NUMBER;
    BEGIN
      insCtx := DBMS_XMLStore.newContext(p_table); -- get saved context
      dbms_xmlstore.setRowTag(insCtx,'Row');
      DBMS_XMLStore.clearUpdateColumnList(insCtx); -- clear the update settings
      -- set the columns to be updated as a list of values
      DBMS_XMLStore.setUpdateColumn(insCtx,'ORDERNUMBER');
      DBMS_XMLStore.setUpdateColumn(insCtx,'PLANT');
      DBMS_XMLStore.setUpdateColumn(insCtx,'MATERIAL');
      DBMS_XMLStore.setUpdateColumn(insCtx,'LINENUMBER');
      DBMS_XMLStore.setUpdatecolumn(insCtx,'NOMSPEED');
      DBMS_XMLStore.setUpdatecolumn(insCtx,'STARTDATE');
      DBMS_XMLStore.setUpdatecolumn(insCtx,'FINISHDATE');
      DBMS_XMLStore.setUpdatecolumn(insCtx,'TARGETQTY');
      DBMS_XMLStore.setUpdatecolumn(insCtx,'UNIT');
      DBMS_XMLStore.setUpdatecolumn(insCtx,'SYSTEMSTATUS');
      v_rows := DBMS_XMLStore.insertXML(insCtx, p_xml_in);
      -- Close the context
      DBMS_XMLStore.closeContext(insCtx);
    END;
    that passes xml file and puts in table but SAP Mii have the limitation that the maximun value of strings is 4000..how can i pass this limitation?!?! someone have some ideia?!?!...i have now to read XML file to stored procedure...could someone help me??
    regards and thanks in advance

    hello Michael thanks for your help but appear to me some strange errors, i created this package in Oracle SQL Developer...
    create or replace PACKAGE PACKAGE_XML AS
      type return_cur IS ref CURSOR;
      procedure INSERTXML4(
        xmlDoc IN CLOB,
        tableName IN VARCHAR2,
        myRC IN OUT return_cur
    END PACKAGE_XML;
    and compile and everthing is ok, then i changed my SP and it looks like this:
    create or replace PROCEDURE INSERTXML4
      (xmlDoc in CLOB, tableName in VARCHAR2, refcur in out package_xml.return_cur)
    AS
      insCtx dbms_xmlsave.ctxType;
      rowcnt number;
    BEGIN
      insCtx := dbms_xmlsave.newContext(tableName);
      dbms_xmlsave.setignorecase(insCtx,1);
      rowcnt := dbms_xmlsave.insertxml(insCtx, xmlDoc);
      dbms_xmlsave.closecontext(insCtx);
      OPEN refcur FOR SELECT rowcnt AS cnt FROM dual;
    END INSERTXML4;
    but i cant compile...it throws this errors:
    Error(5,10): PLS-00201: identifier 'DBMS_XMLSAVE.CTXTYPE' must be declared
            Error(5,10): PL/SQL: Item ignored
            Error(8,3): PLS-00320: the declaration of the type of this expression is incomplete or malformed
            Error(8,3): PL/SQL: Statement ignored
            Error(9,3): PL/SQL: Statement ignored
            Error(9,30): PLS-00320: the declaration of the type of this expression is incomplete or malformed
            Error(10,3): PL/SQL: Statement ignored
            Error(10,13): PLS-00201: identifier 'DBMS_XMLSAVE.INSERTXML' must be declared
            Error(11,3): PL/SQL: Statement ignored
            Error(11,29): PLS-00320: the declaration of the type of this expression is incomplete or malformed
    do you could help..
    regards
    Mário

  • How to pass xml data as objects into Database using store procedures

    Hi All,
         I don't have much knowledge on store procedure,can anybody help how to pass the xml as objects in Database using store procedure.
    My Requirement is I have a table with three fields EMPLOYEE is table name and the fields are EMP_ID,EMP_TYPE AND EMP_DET,I have to insert the employees xml data into corresponding fields in the table.
    Input Data
    <ROWSET>
       <ROW>
         <EMP_ID>7000</EMP_ID>
          <EMP_TYPE>TYPE1</EMP_TYPE>
         <EMP_DET>DEP</EMP_DET>
      <ROW>
      <ROW>
         <EMP_ID>7000</EMP_ID>
         <EMP_TYPE>TYPE2</EMP_TYPE>
        <EMP_DET>DEP2</EMP_DET>
    <ROW>
    <ROW>
         <EMP_ID>7000</EMP_ID>
         <EMP_TYPE>TYPE3</EMP_TYPE>
        <EMP_DET>DEP3</EMP_DET>
    <ROW>
    <ROWSET>
    So each row values has to inserted into resp fields in the table.
    Regards
    Mani

    Do you have a similar structure in your stored procedure ?
    In that case you can simply call the procedure from soa using db adapter and do a mapping to assign the values.

  • Error while refreshing bqy file on workspace using stored procedure

    Hi,
    I am using stored procedure which returns ref-cursor. The report is running fine locally but on Workspace, while refresh, it gives the following error.
    An Interactive Reporting Service error has occurred.-SQL API: [SQLNumResultCols], SQL RETURN: [-1], SQL STATE: [HY010], SQL NATIVE ERROR: [0], SQL MESSAGE: [[Microsoft][ODBC Driver Manager] Function sequence error]
    (0)
    I have ODBC/ODBC connection set up at BI+ configurator.
    Thanks,
    Manish

    We also met this issue. Some guy told me this is a Hyperion limitation, is it true? I really need this function in Hyperion:(

  • I want to store an xml file into database, and transport it to the XI.

    tell me  in how many ways we can store a xml file in database.
    one i know is.- create a table with field same as that of XML. store XML file data in it
    and at the time of transfering data to XI fatch data from table and create an XML file and transfer...
    tell me if u know some more

    Dear Swethi,
    You can move images to SAP using SE78. then u can use them where ever u you require them.
    SE78->GRAPHICS->BMAP here give ur image name and click on save
    Rgds,
    Kiran
    Edited by: Kiran on Jun 11, 2009 7:15 AM

  • How to send XML file into XI using sender HTTP adapter

    I am using HTTP sender adapter to post the XML file into XI. I tried to form the URL by using the following String query , but I am unable to execute file.
    String urlString = "http://<servername:portno>/sap/xi/adapter_plain?namespace=<namespace>&interface=<interface name>&service=<service name>&party=&agency=&scheme=&QOS=BE&sap-user=xiappluser&sap-password=satyam&sap-client=100&sap-language=EN";
    How can I execute xml file by using HTTP sender adapter.
    Any one with better suggestions, about this idea?
    Thanks in advance for all.
    Ram Raj

    Hi
    Just use the following parameter to send xml file using HTTP adapter.
    "http://xiserver:8000/sap/xi/adapter_plain?namespace="senderNamespace"&interface=senderinterface&service=sender service";
    "&party=sender party"&agency=&scheme=&QOS=BE&sap-user=userid &sap-password=password&sap-client=100&sap-language=D";
    with the help of this you are able to point out which interface you would like to use.
    And in payload pass the xml.
    and thats it
    carry on
    Cheers
    Regards
    Piyush

  • Read XML file into sap

    hi all can you please tell any way by which i can read my XML file into SAP and store it into a datavase table in SAP

    Try the below link
    Re: Converting Flat file XML format data to SAP
    may help you
    regards
    pradeep

  • SSRS adhoc (2005/2008) - Need to create Report Model (.smdl file) for adhoc using Stored procedure

    Hi All,
    I need to create Report Models using stored procedures. But whenever I am going to create data sources for same, I am just getting tables and views to use. Please see the screenshot below:
    Is there any way out to create data source based on stored procedure? Please help.
    Thanks in Advance
    Regards
    Kumud

    Hi Kumud,
    As per my understanding, it is not support to create a Datasource View (DSV) using stored procedures.
    In a DataSource View, only views, tables or named queries can be used. We can use stored procedures in a query. No parameterized queries, parameterized stored procedures or parameterized UDFs can be used in a DSV named query. You can try to using below approach
    to achieve what you are require:
    To build views in our relational source and add the views to the datasource view to proceed with modelling.
    There is a similar issue, you can refer to it.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22207c21-03c7-4e5a-bb67-0372f29220a3/sql-server-reporting-services-2008-creating-report-models-using-stored-procedures
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • Reading XML file from specific location&Storing xmldata into related tables

    I am new to xml.
    My requirement is,
    1) Get the xml file from specified location (C:\xmlfiles\ xmldata.xml)
    2)Convert xml data in clob data.
    3)store the data into related table.
    and vice-versa.
    What i did,
    a) I got the data from related tables and converted into xmlformat using SQLX
    b)converted this resultset into clob data and stored as xml file in specific location.
    It uses more then ten tables.
    All this help i got from AskTom site , thanks for that.
    Now i have to do vise-versa, i.e. i have to perform 1), 2), 3) steps........
    Please tell me proper steps to acheive it.
    Thanks in advance for giving your precious time to solve my issue.

    Have you read the"XMLDB FAQ" in this Forum?
    You could use stuff like:
    create or replace directory xmldir as C:\xmlfiles'
    declare
    xmldata xmltype;
    begin
    xmldata := xmltype(bfilename('XMLDIR','xmldata.xml'),nls_charset_id('AL32UTF8'));
      -- etc, etc your code --
      -- --> convert to clob by using for instance getclobval() function
      -- --> then insert the data in your relational table with CLOB column
      -- etc, etc your code --
    end;
    /

  • How to read and upload microsoft word file into database using forms9i

    Hi,
    How to read and upload microsoft word file into oracle database using forms9i. I appretiate if anyone can send me example or atleast a sujjetion.
    Thanks in advance
    Mahesh Ragineni

    The webutil package includes the ability up upload from the client to the database. See otn.oracle.com/products/forms and click on webutil for more details.
    Regards
    Grant Ronald
    Forms Product Management

  • Uploading csv file into database using apex

    Dear all
    I am using apex 4 and oracle express 10g, i need to upload .csv file into the database for one of my appls, i have referred discussion forum for solutions, i found also, but some how its not working for me.
    below mentioned is error and the code
    ERROR:
    ORA-06550: line 38, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 38, column 8: PL/SQL: Statement ignored ORA-06550: line 39, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 39, column 8: PL/SQL: Statement ignored ORA-06550: line 40, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 40, column 8: PL/SQL: Statement ignored ORA-06550: line 41, column 8: PLS-00221: 'V_DATA_ARRAY' is not a proc
    Error
    OK
    CODE:
    DECLARE
    v_blob_data BLOB;
    v_blob_len NUMBER;
    v_position NUMBER;
    v_raw_chunk RAW(10000);
    v_char CHAR(1);
    c_chunk_len number := 1;
    v_line VARCHAR2 (32767) := NULL;
    v_data_array wwv_flow_global.vc_arr2;
    BEGIN
    -- Read data from wwv_flow_files
    select blob_content into v_blob_data
    from wwv_flow_files where filename = 'DDNEW.csv';
    v_blob_len := dbms_lob.getlength(v_blob_data);
    v_position := 1;
    -- Read and convert binary to char
    WHILE ( v_position <= v_blob_len ) LOOP
    v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
    v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
    v_line := v_line || v_char;
    v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved
    IF v_char = CHR(10) THEN
    -- Convert comma to : to use wwv_flow_utilities
    v_line := REPLACE (v_line, ',', ':');
    -- Convert each column separated by : into array of data
    v_data_array := wwv_flow_utilities.string_to_table (v_line);
    -- Insert data into target table
    EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
    values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
    USING
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4);
    v_data_array(5);
    v_data_array(6);
    v_data_array(7);
    v_data_array(8);
    v_data_array(9);
    v_data_array(10);
    v_data_array(11);
    -- Clear out
    v_line := NULL;
    END IF;
    END LOOP;
    END;
    what i understand from this is system does not identify v_data_array as array for some reasons, please help me.
    initially system was giving error for hex_to_decimal, but i managed to get this function on discussion forum and now it seems to be ok. but v_data_array problem is still there.
    thanks in advance
    regards
    Uday

    Hi,
    Mistakes in your sample I did correct
    Problem 1
    select blob_content into v_blob_data
    from wwv_flow_files where filename = 'DDNEW.csv'; to
    select blob_content into v_blob_data
    from wwv_flow_files where name = :P1_FILE;Problem 2
    EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
    values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
    USING
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4);
    v_data_array(5);
    v_data_array(6);
    v_data_array(7);
    v_data_array(8);
    v_data_array(9);
    v_data_array(10);
    v_data_array(11);  to
    EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
    values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
    USING
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4),
    v_data_array(5),
    v_data_array(6),
    v_data_array(7),
    v_data_array(8),
    v_data_array(9),
    v_data_array(10),
    v_data_array(11);  And I did create missing table
    CREATE TABLE TABLE_X
        v1  VARCHAR2(255),
        v2  VARCHAR2(255),
        v3  VARCHAR2(255),
        v4  VARCHAR2(255),
        v5  VARCHAR2(255),
        v6  VARCHAR2(255),
        v7  VARCHAR2(255),
        v8  VARCHAR2(255),
        v9  VARCHAR2(255),
        v10 VARCHAR2(255),
        v11 VARCHAR2(255)
      );Regards,
    Jari
    Edited by: jarola on Nov 19, 2010 3:03 PM

  • Inserting files into lob columns stored procedure

    i have created a stored procedure that inserts file into the database as a lob object. the source code converts the file into a byte [] stream (c#) and assigns to the parameter . please check the pl/sql stored procdure. is there a way to debug pl/sql code in vs 2005.
    PROCEDURE "STARDOC"."INSERTFILE" (
    "TITLE" IN VARCHAR2,
    "AUTHOR" IN VARCHAR2,
    "DESCRIPTION" IN VARCHAR2,
    "PUBLISHER" IN VARCHAR2,
    "LANGUAGE_ID" IN NUMBER,
    "CONTENT" IN BLOB DEFAULT empty_blob(),
    "FILENAME" IN VARCHAR2,
    "EXTENSION" IN VARCHAR2,
    "APPID" IN NUMBER,
    "DOC_SIZE" IN NUMBER,
    "CONTENT_TYPE_ID" IN NUMBER,
    "IDENTIFIER" IN VARCHAR2,
    "DOC_ID" OUT NUMBER) IS
    docid number;
    BEGIN -- executable part starts here
         SELECT seq_document_id.NEXTVAL INTO docid FROM dual;
         --Documents table     
         INSERT INTO DOCUMENTS(document_id, content, filename,
                                  extension, retrieval_metadata_id,
                                       content_metadata_id,description)
              VALUES (docid,content,filename,extension,docid,docid,description);
         --Content Metadata table     
         INSERT INTO CONTENT_METADATA(content_metadata_id, document_id,
                                            author, title, description,
                                            publisher, language_id, content_type_id)
              VALUES (docid, docid, author,
                        title, description, publisher,     
                        language_id, content_type_id);
         --retrieval metadata table
         INSERT INTO RETRIEVAL_METADATA(retrieval_metadata_id, identifier)
              VALUES (docid,identifier);
         --Storage metadata table
         INSERT INTO STORAGE_METADATA(storage_metadata_id, application_id,doc_size)
              VALUES (docid,appid, doc_size);
    EXCEPTION
    --rollback when an expetion occurs
    WHEN OTHERS THEN
              ROLLBACK;
    END "INSERTFILE";

    Yes.
    Are you experiencing any issues? From your posts above there is no mention of any issues you are facing that could ba attributed to the LOB size.
    Has the procedure been run at least once?

  • Reading XML file into Dynamic Node and Display its output as Table.

    Hi All,
    Following is the output of XML file:
       <Company>
         <Employee>
              <Name>John</Name>
              <Age>23</Age>
              <***>Male</***>
              <Location>Frankfurt</Location>
         </Employee>
         <Employee>
              <Name>Tina</Name>
              <Age>21</Age>
              <***>Female</***>
              <Location>Boston</Location>
         </Employee>
         <Department>
              <Name>Sales</Name>
              <HQ>Chicago</HQ>
              <Emplyoees>2300</Employees>
         </Department>     
    I'm able to read the output through DOM parser. But How do I convert this into dynamic node and display this in Web dynpro as Table?
    Any pointers in this regard will be great help?
    Thanks
    Srikant

    Hi Maksim,
    I've used your example and its now helping as there is kind of agreement on that I'll be knowing the structure of Xml and I can fill the nodes.
    But suppose if you have Xml has following structure :
    <?xml version="1.0" encoding="utf-8"?><DATA>
    <item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">CONTRACT</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
    <item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">CREDIT</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
    <item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">EMPRESS</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
    <item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">PAYMENT</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
    <item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">PRICE</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
    </DATA>
    How we will do in this case?
    Can we have something similar using DOM? Also what is the best method for displaying data being sent in form of XML. And generalize it for cases like this.
    Thanks
    Srikant

Maybe you are looking for

  • How to print from iPad via WiFi

    Hi, My printer is a HP Photosmart C4680 who's usb cable is connected to a small box or hp print server that connects wirelessly to my Linksys router. I tried Airprint but it didn't work because my printer is not in their list. Then I tried HP iPrint

  • Issue with OracleHelp loading HelpSet with space in file path

    Hi, I'm running into an issue where I cannot get OracleHelp to load a HelpSet correctly with RoboHelp contains when the file is in a directory with a file space in it. This will load successfully if the path does not contain any white spaces. It look

  • Why can't I get facetime to work?

    I have activated facetime the iphone, the wifi works but when someone calls using facetime, the caller has a ring tone and it just rings and rings. Nothing happens on the receiving end. However a missed call message comes up once the caller hangs up.

  • Why can't I drag in audio in Adobe Premiere Pro CC?

    I am currently editing a film in Premiere and trying to drag in a few clips that contain both audio and video. They were shot on a 5D Mark II and are .MOV files. When dragging them from the media browser to my timeline, the video is dropped but the a

  • Can't delete custom dictionary 8120

    Whenever I try to delete or clear the custom dictionary on my 8120, it clears out. However after a battery pull reboot everything reappears. If I use the Desktop manager 5.0 and go to backup/restore>advanced I try to cleat the custom words collection