Insert Data into Table from TXT or CSV file !!!!!

Dear All,
Recently I have started working on APEX. In Oracle Forms, we used to use TEXT_IO for inserting records into tables from txt files. Now I want to do the same thing in apex 3.2. How can I insert data into tables from txt of csv files.
Waiting of your valuable suggestions.
With kind regards,
Yousuf.

Yousuf
wwv_flow_files is used by APEX to hold uploaded files.
If you incorporate a file browse item on you page, browse for the selected file, then submit the page (having the PL/SQL process described as an on suibmit process) then what I detailed should work.
If you don't need users to have access to this then just go to Home>Utilities>Data Load/Unload in APEX and there is a handy load utility there that does it all for you.
Cheers
Ben

Similar Messages

  • Insert data into table from JSP page using Entity Beans(EJB 3.0)

    I want to insert data into a database table from JSP page using Entity Beans(EJB 3.0).
    1. I have a table 'FRIENDS', (in Oracle 10g database).
    2. It has two columns, 'NAME' and 'CITY'. Both have datatype strings(varchar2).
    3. Now from a JSP page, having two textfields, 'NAME' and 'CITY', I want to insert data into table 'FRIENDS'.
    4. In between JSP and database is a Entity Bean(EJB 3.0) and a stateless session bean.
    5. I am using JDev as editor.
    Please provide me code ASAP or link with similar example.
    Thank you.
    Anurag

    Hi,
    I am also trying that scenario. So u can
    Post the jsp form data to a Servlet which will act as a Controller.
    In the servlet invoke the business method.
    Similar kind of app is in www.roseindia.net
    Hope this would help u.
    Meanwhile if u get any optimal solution, pls post it.
    Thanks,
    Happy Java Coding.

  • Need Logic for Inserting data into table from another table

    Hi,
    Could you please give me some logic on below:
    TABLE_A has columns A,B,C,D
    What i did
    ==========
    Created new table
    TABLE_1_A with columns A1,A2,B1,B2,B3
    Requirement
    ===========
    I should populate columns A1,A2 (table TABLE_1_A) with the data from column A (table TABLE_A)
    & simillarly populate columns B1,B2 with the data from B.
    the data is huge in the table_a.
    Database: 10g
    Thanks.

    Hi,
    Here's one way:
    INSERT INTO  table_1_a
            (a1, a2, b1, b2)
    SELECT      a,  a,  b,  b
    FROM      table_a
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    If you're asking about a DML statement, such as INSERT, the sample data will be the contents of the table before the DML, and the results will be state of the changed table(s) when everything is finished.
    Explain, using specific examples, how you get those results from that data.
    See the forum FAQ {message:id=9360002}

  • Please help me in inserting data into table from XML message.

    Hi Experts,
    Please provide a procedure to implement my below requirement.
    Since I am new to queue concept.
    [code]- <MESSAGES>
    - <MESSAGE ID="3026900">
      <MSG_ID>3026900</MSG_ID>
      <DT_POSTED>6/20/2013 08:15:48</DT_POSTED>
      <POSTED_BY>GPD_MSG_EXTRACTOR</POSTED_BY>
      <DT_LAST_QUEUED />
    - <MSG>
    - <WORK_SET TRANSACTION_ID="@TRANS_ID" TRANSACTION_TYPE="Batch" IS_ACID="@IS_ACID">
    - <WORK_UNIT GROUP="LEAD_TIME" ACTION="UPDATE" AFFECTED="LEAD_TIME">
    - <RECORDSET TABLE_NAME="LEAD_TIME">
    - <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
    - <rs:data>
      <z:row business_unit_id="3838" geo="AT" sku="A0814818" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      <z:row business_unit_id="202" geo="GB" sku="A0814819" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      <z:row business_unit_id="2828" geo="BE" sku="A0814820" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      </rs:data>
      </xml>
      </RECORDSET>
      </WORK_UNIT>
    - <WORK_UNIT GROUP="LEAD_TIME" ACTION="ADD" AFFECTED="LEAD_TIME">
    - <RECORDSET TABLE_NAME="LEAD_TIME">
    - <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
    - <rs:data>
      <z:row business_unit_id="202" geo="GB" sku="A0814821" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      <z:row business_unit_id="2828" geo="BE" sku="A0814822" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      </rs:data>
      </xml>
      </RECORDSET>
      </WORK_UNIT>
    - <WORK_UNIT GROUP="LEAD_TIME" ACTION="DELETE" AFFECTED="LEAD_TIME">
    - <RECORDSET TABLE_NAME="LEAD_TIME">
    - <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
    - <rs:data>
      <z:row business_unit_id="202" geo="GB" sku="A0814817" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      <z:row business_unit_id="2828" geo="BE" sku="A0814816" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
      </rs:data>
      </xml>
      </RECORDSET>
      </WORK_UNIT>
      </WORK_SET>
      </MSG>
      </MESSAGE>
      </MESSAGES>[/code]
    The above XML message is receieved by our oracle queue.Once the message is receieved to our queue.
    We have to process the message according to the action(UPDATE ADD DELETE).
    From this message we have to process only 3 fields (geo  sku lead_time).
    These three feilds data should be processed into the SKU_LEAD_TIME table based on the action.
    Req1:
    IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
    IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
    based on the below condition.
    [code]UPDATE LEAD_TIME_TABLE SET lead_time= lead time from xml message
    WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;[/code]
    Req2:
    IF the action is delete then the records should be deleted from the "LEAD_TIME_TABLE" table.
    based on the below condition.
    [code]DELETE FROM LEAD_TIME_TABLE
    WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;[/code]
    Req3:
    IF the action is add then the records should be inserted in the "LEAD_TIME_TABLE"  and "LEAD_TIME_TABLE_STAGING" table
    based on the below conditions.
    Req3.1:
    If SKU from XML message is available in "SKU_TABLE" table
    then the three parameter(GEO SKU LEAD_TIME) values from XML message should be inserted into "LEAD_TIME_TABLE" table.
    Req3.2:
    If SKU from XML message is not available in "SKU_TABLE" table
    then the three parameter(GEO SKU LEAD_TIME) values from XML message should be inserted into "LEAD_TIME_TABLE_STAGING" table.
    Req3.3:
    Once the new SKU is avilable in "SKU_TABLE" table then the corresponding SKU record should be
    inserted into "LEAD_TIME_TABLE" table and that record should be deleted from  "LEAD_TIME_TABLE_STAGING" table.
    I am posting required scripts and test cases.
    [code]CREATE TABLE LEAD_TIME_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class CHAR(1),geo VARCHAR2(6),lead_time NUMBER,created DATE);
    CREATE TABLE LEAD_TIME_TABLE_STAGING(sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
    CREATE TABLE SKU_TABLE(sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
    INSERT INTO SKU_TABLE VALUES('A0814817','GB',30);
    INSERT INTO SKU_TABLE VALUES('A0814818','AT',30);
    INSERT INTO SKU_TABLE VALUES('A0814819','GB',30);
    INSERT INTO SKU_TABLE VALUES('A0814820','BE',30);
    INSERT INTO SKU_TABLE VALUES('A0814821','GB',30);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814817','GB',30);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814818','AT',20);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814819','GB',20);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814820','BE',20);
    INSERT INTO LEAD_TIME_TABLE_STAGING VALUES('A0814822','BE',30);[/code]
    From the above message.
    Test case for req3.1:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814821" is available in SKU_TABLE table.
    so the record should be inserted in the LEAD_TIME_TABLE.
    [code]SELECT * FROM LEAD_TIME_TABLE;
    SKU        GEO   LEAD_TIME
    A0814817    GB    30
    A0814818    AT    20
    A0814819    GB    20
    A0814820    BE    20
    A0814821    GB    30[/code]
    Test case for req3.2:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814822" is not available in SKU_TABLE table.
    so the record should be inserted in the LEAD_TIME_TABLE_STAGING.
    [code]SELECT * FROM LEAD_TIME_TABLE_STAGING;
    SKU        GEO   LEAD_TIME
    A0814822    BE     30[/code]
    Test case for req3.3:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814822" is not available in SKU_TABLE table.
    Once I insert SKU number "A0814822" in SKU_TABLE table.
    The corresponding records automatically should be inserted in the LEAD_TIME_TABLE
    and should be deleted from LEAD_TIME_TABLE_STAGING.
    [code]SELECT * FROM LEAD_TIME_TABLE_STAGING;  --- should return NULL.
    SELECT * FROM LEAD_TIME_TABLE;
    SKU        GEO   LEAD_TIME
    A0814817    GB    30
    A0814818    AT    20
    A0814819    GB    20
    A0814820    BE    20
    A0814821    GB    30
    A0814822    BE    30[/code]
    Please help me.
    Thanks in advance.

    Hi,
    I have resolved this issue.
    But I have stuck up in implementing some of the scenarios.
    Req1:
    IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
    IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
    based on the below condition.
    UPDATE LEAD_TIME_TABLE SET lead_time= lead time from xml message
    WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;
    Req3:
    IF the action is add then the records should be inserted in the "LEAD_TIME_TABLE"  and "LEAD_TIME_TABLE_STAGING" table
    based on the below conditions.
    Req3.1:
    If SKU from XML message is available in "schema_name.SKU_TABLE" table.
    The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of XML message and "sid" of MAPPING table WHERE business_unit_id=sid.
    then the three parameter(GEO SKU LEAD_TIME) values from XML message and two fields MODEL,CLASS from SKU_TABLE
    should be inserted into "LEAD_TIME_TABLE" table.
    Req3.2:
    If SKU from XML message is not available in "schema_name.SKU_TABLE" table
    The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of XML message and "sid" of MAPPING table WHERE business_unit_id=sid.
    then the four parameter(BUSINESS_UNIT_ID GEO SKU LEAD_TIME) values from XML message
    should be inserted into "LEAD_TIME_TABLE_STAGING" table.
    Req3.3:
    Once the new SKU is avilable in "schema_name.SKU_TABLE" table then the corresponding SKU record should be
    inserted into "LEAD_TIME_TABLE" table and that record should be deleted from  "LEAD_TIME_TABLE_STAGING" table.
    The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of LEAD_TIME_TABLE_STAGING and "sid" of MAPPING table WHERE business_unit_id=sid.
    I am posting required scripts and test cases.
    [code]CREATE TABLE LEAD_TIME_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class CHAR(1),geo VARCHAR2(6),lead_time NUMBER,created DATE);
    CREATE TABLE LEAD_TIME_TABLE_STAGING(business_unit_id NUMBER,sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
    CREATE TABLE SKU_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class VARCHAR2(10));
    CREATE TABLE mapping(sid NUMBER,schema_name VARCHAR2(20));
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814817','GB',30);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814818','AT',20);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814819','GB',20);
    INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814820','BE',20);
    INSERT INTO SKU_TABLE VALUES('A0814817','M125','C111');
    INSERT INTO SKU_TABLE VALUES('A0814818','M127','A111');
    INSERT INTO SKU_TABLE VALUES('A0814819','M126','A111');
    INSERT INTO SKU_TABLE VALUES('A0814820','N100','B111');
    INSERT INTO SKU_TABLE VALUES('A0814821','P123','B111');
    INSERT INTO mapping VALUES(202,'WEDB');
    INSERT INTO mapping VALUES(2828,'HR');
    INSERT INTO mapping VALUES(3838,'BB');
    [/code]
    Test case for req3.1:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814821" is available in schema_name.SKU_TABLE table.
    so the record should be inserted in the LEAD_TIME_TABLE.
    [code]SELECT * FROM LEAD_TIME_TABLE;
    SKU        MODEL  CLASS  GEO   LEAD_TIME
    A0814817    M125   C111   GB     30
    A0814818    M127   A111   AT     20
    A0814819    M126   A111   GB     20
    A0814820    N100   B111   BE     20
    A0814821    P123   B111   GB     30
    [/code]
    Test case for req3.2:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814822" is not available in SKU_TABLE table.
    so the record should be inserted in the LEAD_TIME_TABLE_STAGING.
    [code]SELECT * FROM LEAD_TIME_TABLE_STAGING;
    BUSINESS_UNIT_ID       SKU        GEO   LEAD_TIME
    2828               A0814822    BE     30[/code]
    Test case3.3.3:
    The action for SKU numbers "A0814821"  "A0814822" are insert.
    The SKU number  "A0814822" is not available in SKU_TABLE table.
    Once I insert SKU number "A0814822" in SKU_TABLE table.
    The corresponding records automatically should be inserted in the LEAD_TIME_TABLE
    and should be deleted from LEAD_TIME_TABLE_STAGING.
    [code]INSERT INTO SKU_TABLE VALUES('A0814822','P123','B111');
    SELECT * FROM LEAD_TIME_TABLE_STAGING;  --- should return NULL.
    SELECT * FROM LEAD_TIME_TABLE;
    SKU        MODEL  CLASS  GEO   LEAD_TIME
    A0814817    M125   C111   GB     30
    A0814818    M127   A111   AT     20
    A0814819    M126   A111   GB     20
    A0814820    N100   B111   BE     20
    A0814821    P123   B111   GB     30
    A0814822    P123   B111   GB     30[/code]
    I am able to implement Req1 and Req3.1 for action UPDATE and INSERT in single merge statement.
    However my code is not taking care of all my requirements.
    Please find my below code.
    [code]   CREATE OR REPLACE PACKAGE BODY messg_values_process
       AS
        procedure ProcessInboundLtimeMessage(p_xml_message XmlType)
        is
        begin
            for work_unit in (
                select message.MESSAGE_ID
                     , work_unit.ACTION
                     , work_unit.LEADTIME_NODES
                  from XmlTable(
                        '/MESSAGES/MESSAGE'
                        passing p_xml_message
                        columns
                            MESSAGE_NO          for ordinality
                          , MESSAGE_ID          number path '@ID'
                          , WORK_UNIT_NODES     XmlType path 'MSG/WORK_SET/WORK_UNIT'
                       ) message
                     , XmlTable(
                        XmlNamespaces(
                            'urn:schemas-microsoft-com:rowset' as "rs"
                          , '#RowsetSchema' as "z"
                        '/WORK_UNIT'
                        passing message.WORK_UNIT_NODES
                        columns
                            WORK_UNIT_NO        for ordinality
                          , ACTION              varchar2(10 char) path '@ACTION'
                          , LEADTIME_NODES       XmlType path 'RECORDSET[@TABLE_NAME="LEAD_TIME"]/xml/rs:data/z:row'
                       ) work_unit
        LOOP
                CASE work_unit.ACTION
                  WHEN 'ADD'    THEN MergeData(work_unit.LEADTIME_NODES);
                  WHEN 'UPDATE' THEN MergeData(work_unit.LEADTIME_NODES);
                  WHEN 'DELETE' THEN RemoveData(work_unit.LEADTIME_NODES);
                  ELSE null;
                END CASE;
            END LOOP;
        END ProcessInboundLtimeMessage;
            procedure MergeData(p_leadtime_nodes XmlType)
        is
        begin
            if (p_leadtime_nodes is not null) then
                merge into LEAD_TIME_TABLE old
                using(
                    select *
                      from XmlTable(
                            XmlNamespaces(
                                'urn:schemas-microsoft-com:rowset' as "rs"
                              , '#RowsetSchema' as "z"
                            '/z:row[not(@business_unit_id=following-sibling::z:row/@business_unit_id)]'
                            passing p_leadtime_nodes
                            columns
                                ITEM_NO             for ordinality
                              , BUSINESS_UNIT_ID    number path '@business_unit_id'
                              , GEO                 varchar2(20 char) path '@geo'
                              , SKU                 varchar2(20 char) path '@sku'
                              , LEAD_TIME           number path '@lead_time'
                ) NEW
                   ON (old.VK_UNIT = new.SKU
                  AND old.GEO=new.GEO)
                when matched then update
                   set old.LEAD_TIME = new.LEAD_TIME
                when not matched then INSERT
                     ( old.VK_UNIT
                     , old.MODEL
                     , old.CLASS
                     , old.GEO
                     , old.LEAD_TIME
                     , old.COUNTDOWN
                     , old.LAST_UPDATED_DATE
                     values
                     ( new.SKU
                     ,'A123'
                     ,'A1234'
                     , new.GEO
                     , new.LEAD_TIME
                     , 'N'
                     , sysdate
            end if;
             exception
            when others then
                LogDataError(
                    'MergeData Procedure Failed #: '||chr(10)||sqlerrm
                  , null
                  , null
        END MergeData;
    END messg_values_process;
    /[/code]
    Please help me.
    Thanks.

  • Insert data into table from report

    hello
    I have a report with "Forms Letter"style. I want to create 2 buttons say "APPROVE" and "CHANGE". When clicked on "APPROVE" button I want to insert some data into the table. And When Clicked on "CHANGE" button, I want to call one form. I am using oracle10g.
    Oracle 10g doesn't support button. Then what is the solution for my problem.
    Bye....

    as you correctly stated, reports does not provide buttons but you could use hyperlinks. openign a form, however, will be tricky. everything nees to be URL based.
    thanks,
    philipp

  • How can i insert data into DB from my page programatically in Oracle ADF..?

    Hai, this is praveen.
    I have created  an EO and VO, when i have inserted data by dragging and dropping from DataControl -->Operations-->Create. I have successfully inserting data. But how can i do it programatically. What are the pre-defined steps that i can use over there to insert data into table programatically. Could u plz help me?

    Hi,
    You have to create an action Listener in the bean for any button.
    Then call an AM method.
    In that you have to do the following
    ViewObject yourVO = getYourVO();
    Row r = yourVo.createRow();
    r.setAttribute("Column1", value1); //the name of column should be as it is in your vo attribute.
    yourVO.insertRow(r);
    this.getDbTransaction().commit();
    Thanks

  • How to insert data into table control

    hi experts,,
           i have inserted data into data base table through table control .
    now i want to insert data into table control through database table.
      how to delete data from table control for selected row

    Hi
    go through this link.
    http://www.****************/Tutorials/ABAP/TableControl/Demo.htm

  • Please recommend if we have options to read xml file and insert data into table without a temporary table.

    Please recommend if we have options to read xml file and insert data into table without a temporary table. 

    DECLARE @data XML;
    SET @data =N'<Root>
    <List RecordID="946236" />
    <List RecordID="946237" />
    <List RecordID="946238" />
    <List RecordID="946239" />
    <List RecordID="946240" />
    </Root>'
    INSERT INTO t (id) SELECT T.customer.value('@RecordID', 'INT') AS id
    FROM @data.nodes('Root/List')
     AS T(customer);
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Insert data into table 1 but remove the duplicate data

    hello friends,
    i m trying to insert data into table tab0 using hints,
    query is like this..
    INSERT INTO /*+ APPEND PARALLEL(tab0) */ tab NOLOGGING
    (select /*+ parallel(tab1)*/
    colu1,col2
    from tab1 a
    where a.rowid =(select max (b.rowid) from tab2 b))
    but this query takes too much time around 5 hrs...
    bz data almost 40-50 lacs.
    i m using
    a.rowid =(select max (b.rowid) from tab2 b))....
    this is for remove the duplicate data..
    but it takes too much time..
    so please can u suggest me any ohter option to remove the duplicate data so it
    resolved the optimization problem.
    thanks in advance.

    In the code you posted, you're inserting two columns into the destination table. Are you saying that you are allowed to have duplicates in those two columns but you need to filter out duplicates based on additional columns that are not being inserted?
    If you've traced the session, please post your tkprof results.
    What does "table makes bulky" mean? You understand that the APPEND hint is forcing the insert to happen above the high water mark of the table, right? And you understand that this prevents the insert from reusing space that has been freed up because of deleted in the table? And that this can substantially increase the cost of full scans on the table. Did you benchmark the INSERT without the APPEND hint?
    Justin

  • Usage of sequence for uploading data into tables(column store) using CSV

    How to make use of sequence when data is uploaded into table(column store) with the CSV file ?

    Hi Sharada,
    You may have to follow the below steps:
    1) To load the data from flat file to a Staging table using IMPORT command
    2) You have to call the procedure to load the data further into final Table.
    a) Have a look on this procedure to load data :
    SAP HANA: Generic Procedure using Arrays to Load delta data into Tables
    b) See my reply on the syntax on how to use "Sequence"
    Auto-Incrementor in stored procedure!
    You will have to ensure that you frame your insert query in such a way to have the sequence number in the target table.
    Regards,
    Krishna Tangudu

  • How do you access a web service to insert data into table?

    Ok I have a simple html/jsp survey form to host on our web site. Because of firewall issues I cannot do a direct connect to the database and insert the data from the form. So I need to take the data from the survey form, and pass it to an existing web service, or create a web service that will insert this information for me into the database table?
    Thanks again.
    orozco

    Thanks for the reply shanu. Well, because of firewall issues, as a work around we use a web service to insert data into the database table. Since the Web Service already exist, we just thought it would be easy enough just to pass the parameters to it, and have it do the insert. So really all I need is just to communicate with the already existing web service. I will be honest though I have not really worked with web services before.
    orozcom

  • Query for inserting data into table and incrementing the PK.. pls help

    I have one table dd_prohibited_country. prohibit_country_key is the primary key column.
    I have to insert data into dd_prohibited_country based on records already present.
    The scenario I should follow is:
    For Level_id 'EA' and prohibited_level_id 'EA' I should retreive the
    max(prohibit_country_key) and starting from the maximum number again I have to insert them
    into dd_prohibited_country. While inserting I have to increment the prohibit_country_key and
    shall replace the values of level_id and prohibited_level_id.
    (If 'EA' occurs, I have to replace with 'EUR')
    For Instance,
    If there are 15 records in dd_prohibited_country with Level_id 'EA' and prohibited_level_id 'EA', then
    I have to insert these 15 records starting with prohibit_country_key 16 (Afetr 15 I should start inserting with number 16)
    I have written the following query for this:
    insert into dd_prohibited_country
    select     
         a.pkey,
         b.levelid,
         b.ieflag,
         b.plevelid
    from
         (select
              max(prohibit_country_key) pkey
         from
              dd_prohibited_country) a,
         (select
    prohibit_country_key pkey,
              replace(level_id,'EA','EUR') levelid,
              level_id_flg as ieflag,
              replace(prohibited_level_id,'EA','EUR') plevelid
         from
              dd_prohibited_country
         where
              level_id = 'EA' or prohibited_level_id = 'EA') b
    My problem here is, I am always getting a.pkey as 15, because I am not incrementing it.
    I tried incrementing it also, but I am unable to acheive it.
    Can anyone please hepl me in writing this query.
    Thanks in advance
    Regards
    Raghu

    Because you are not incrementing your pkey. Try like this.
    insert
       into dd_prohibited_country
    select a.pkey+b.pkey,
         b.levelid,
         b.ieflag,
         b.plevelid
       from (select     max(prohibit_country_key) pkey
            from dd_prohibited_country) a,
         (select     row_number() over (order by prohibit_country_key)  pkey,
              replace(level_id,'EA','EUR') levelid,
              level_id_flg as ieflag,
              replace(prohibited_level_id,'EA','EUR') plevelid
            from     dd_prohibited_country
           where level_id = 'EA' or prohibited_level_id = 'EA') bNote: If you are in multiple user environment you can get into trouble for incrementing your PKey like this.

  • Insert data into table

    When I try to insert data into the table, I get the error message:
    [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The name 'uniqueID' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
    What is wrong in the following code?
    String uniqueID, GenericType;
    float elevation, CalcTotalHeight, CalcTotalArea, CalcTotalVolume;
    stmt.executeUpdate(
    "INSERT INTO IFCData VALUES (uniqueID, GenericType, elevation, CalcTotalHeight, CalcTotalArea, CalcTotalVolume)" );

    No, sorry, now that I look at it for more than five seconds, your SQL is wrong.
    You don't have a list of columns that you are updating; I'm not sure whether this is bad SQL or whether the database will assume you meant to update all the columns in their declared order. But more to the point, the "values" you are assigning to those columns are not what you want. For example, the value you assign to the first column is uniqueid, meaning either the column named uniqueid or some SQL constant named uniqueid. There isn't any such thing, hence the message.
    I suppose you wanted to put the value of the Java variable "uniqueid" there. Of course the database and the JDBC driver don't know anything about the names of variables in your code, so they can't replace the string "uniqueid" by the value of the variable. The way to do that is to use a prepared statement, like this:PreparedStatement ps = conn.prepareStatement("INSERT INTO IFCData VALUES (?, ?, ?, ?, ?, ?)");
    // fix this SQL so you name the columns you are inserting into as well
    ps.setString(1, uniqueID);
    ps.setString(2, GenericType);
    ps.setFloat(3, elevation);
    // and so on
    ps.executeUpdate();PC&#178;

  • Error While Inserting Data into table using OAF

    Hi Experts,
    I am learning OAF; i am trying into insert the data into table using OAF. I followed the below procedure.
    My table(OLF_TEST_TBL) Columns:
    EmpID (Number), Ename(VARCHAR2 100), Sal Number, and who columns.
    1. created Application Module (AM).
    package: oracle.apps.mfg.simplepg.server
    name: oaf_test_tbl_am
    2. created simple page
    name:EmployeePG
    package:oracle.apps.mfg.simplepg.webui
    3. Assigned the Application Module to Page
    4. Created Entity Object(EO)
    name:oaf_test_tbl_eo
    package:oracle.apps.mfg.simplepg.schema.server
    schema:apps
    table:OLF_TEST_TBL
    note:
    1. EMPID column is selected as primary key
    2. selected create method, remove method and validation method.
    3.checked generate default view object
    VO:
    name:olf_test_tbl_vo
    note: Entity Object was assigned to VO
    Coming To page:
    page main region:EmployeeMainRN
    1.under main region i created one more region using wizard
    selected AM and VO, region style-default single column
    2. under main region i created one more region
    region style- pagebuttonbar, ID:pagebutoonsRN
    3. under pagebuttonRN, created two submit buttons(ID:SUBMIT, ID:CANCEL).
    In AM java page:
    created a method to insert row and for commit.
    Insert Method:
    public void insertrow(){
    OAViewObject vo=(OAViewObject)getoaf_test_tbl_vo1();
    if(!vo.isPreparedForExecution()){
    vo.executeQuery();
    Row row=vo.createRow();
    vo.insertRow(row);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    Commit Method:
    public void savaDataTooaftesttable(){
    getDBTransaction().commit();
    In EmployeeMainRN, created a controller.
    In this controller process request method, 'insertrow' method was called.
    import oracle.apps.fnd.framework.OAApplicationModule;
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    if (!pageContext.isFormSubmission())
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    am.invokeMethod("insertrow");
    To commit the transaction when SUBMIT button pressed, commit method was called in process form request method.
    import oracle.apps.fnd.framework.OAViewObject;
    public void processformRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("SUBMIT") != null)
    am.invokemethod("savaDataTooaftesttable");
    Error After clicking the submit button_
    I ran the page, page was opened successfully. Once i enter data and click submit button, it's giving the following error.
    The requested page contains stale data. This error could have been caused through the use of the browser's navigation buttons (the browser Back button, for example). If the browser's navigation buttons were not used, this error could have been caused by coding mistakes in application code. Please check Supporting the Browser Back Button developer guide - View Object Primary Key Comparison section to review the primary causes of this error and correct the coding mistakes.
    Cause:
    The view object oaf_test_tbl_am.oaf_test_tbl_vo1700_oaf_test_tbl_vo1_practice_test_prc1_oracle_apps_mfg_simplepg_server_oaf_test_tbl_am.oaf_test_tbl_vo1 contained no record. The displayed records may have been deleted, or the current record for the view object may not have been properly initialized.
    To proceed, please select the Home link at the top of the application page to return to the main menu. Then, access this page again using the application's navigation controls (menu, links, and so on) instead of using the browser's navigation controls like Back and Forward.
    Experts, Kindly help me why i am getting this error.
    Awating your replies.
    Thanks in advance.

    If you dont want to create message. You can throw exception like below as well
              throw new OAException("Emp Id is "+empId+" and employee name is "+empName, OAException.CONFIRMATION);Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Procedure to insert data into table by selecting data from another table

    Hi all,
    I have to create a procedure where i have to select the data from one table and insert it into another table. Any help on this. And i have to update the 2nd table also when ever new records got inserted in the 1st table then.
    Regards

    Hi, you can try something like:
    CREATE [OR REPLACE] PROCEDURE procedure_name
    IS
    BEGIN
    INSERT INTO TABLE1
    VALUES (SELECT * FROM TABLE2);
    END;
    For the other part you may create a trigger on the first table AFTER INSERT to insert the values in the second table too.

Maybe you are looking for