Insert into local table as select from remote tables

Hi all,
In Oracle DB version 11g i have the following issue:
I want to insert into a table in the current schema as selecting data from two remote tables. I execute the insert in portions of data. Firstly, when the target table where i want to insert is empty the Select as Insert is being executed very fast. But after every insert i made , the performance became worse than the previous one. I have no FKs or indexes in the local table/target table where i'm inserting/... I tried using /*+ append*/ hint but no success...what should be the reason of that?
Thanks in advance,
Alexander.

a.stoyanov wrote:
Hi all,
In Oracle DB version 11g i have the following issue:
I want to insert into a table in the current schema as selecting data from two remote tables. I execute the insert in portions of data. Firstly, when the target table where i want to insert is empty the Select as Insert is being executed very fast. But after every insert i made , the performance became worse than the previous one. I have no FKs or indexes in the local table/target table where i'm inserting/... I tried using /*+ append*/ hint but no success...what should be the reason of that?
Thanks in advance,
Alexander.How should we know? You don't give enough information to be able to tell. Not even the SQL involved.
Please read {message:id=9360002} and {message:id=9360003}
and follow the advice given.

Similar Messages

  • PL/SQL: ORA-22992: cannot use LOB locators selected from remote tables

    Dear ALL,
    My O/S is Redhatlinux 5.2 and i had Migrated my Oracle databse to 11g2. But after that while i am retrieving records through dblinks from one of my other Oracle 9.2.0.8 databse it's throwing the error : PL/SQL: ORA-22992: cannot use LOB locators selected from remote tables.* This error i am getting in TOAD as well as SQL Developer.
    Can anybody tell me how to fix this error ? Because am not able to get the records.
    Also am getting another error during retrieving data from some of my tables after migrating i.e the table which having CLOB data type while am accessing to retrieve the records using select query it's throwing the error :
    +(The following error has occurred:+
    A query with LOB's requires OCI8 mode, but OCI7 mode is used.)
    If anyone having any idea kindly share.
    Thanks and Regards
    Biswa

    Hi,
    Ya what u sent that is fine. But already am using one procudure which is accessing LOB data from another databse through DBlink and working fine. But there Both the databse are 9.2.0.8.
    But while am executing the same procedure in oracle 11g where the Dblink accessing the data from Oracle 9i , there am getting this error.
    Kindly tell if u know any resolution.
    Thanks

  • ORA-22992: cannot use LOB locators selected from remote tables

    Has anyone had this error msg before?
    Thx .

    If you want, you could facilitate your process with a global temporary table as follows:
    SQL> create global temporary table clob_temp (
      2  id         number,
      3  test_clob  clob)
      4  on commit delete rows;
    Table created.
    SQL> Create or Replace procedure run_clob (p_id in number, p_file_name in varchar2)
      2    AS
      3       l_clob          clob;
      4       l_bfile         bfile := BFILENAME ('TEMP_DIR', p_file_name);
      5  begin
      6      insert into clob_temp values (p_id, empty_clob() )
      7               returning test_clob into l_clob;
      8      DBMS_LOB.OPEN(l_bfile, DBMS_LOB.LOB_READONLY);
      9      DBMS_LOB.LOADFROMFILE(l_clob, l_bfile, DBMS_LOB.getlength(l_bfile));
    10      DBMS_LOB.CLOSE(l_bfile);
    11      insert into clob_table@dlog_link (id, test_clob)
    12               select * from clob_temp;
    13      commit;
    14  end;
    15  /
    Procedure created.
    SQL> select count(*) from clob_table@dlog_link;
      COUNT(*)
             0
    SQL> exec run_clob (1, 'clobtest.txt')
    PL/SQL procedure successfully completed.
    SQL> select count(*) from clob_table@dlog_link;
      COUNT(*)
             1

  • Select  from remote table

    Hi, i have two user schemas.
    BIQUERYRHTST and BIETLRHTST
    On BIQUERYRHTST, i have a database link.
    and i execute the following sentence
    select * from [email protected], and it works correctly.
    If i want to execute the same select on BIETLRHTST, what permissions does i need?
    Without have to create the dblink on BIETLRHTST
    Thanks

    Check more information about CREATE DATABASE LINK
    If you created a private database link as mentioned in the doc, you can't share it with other user. Create a public database link instead.

  • Update table with select from another table

    Hallo,
    I'd like to update table b with codes from a mapping table a.
    a has:
    town_id, town_code, town_name
    b has town_code, town_id, town_population, town_zip_code,...
    Table a has all the details - town_id, town_code and town_name and acts as the mapping between town_id and town_code
    In table b, town_code is null. I want to update the column b.town_code with town_code from table a where a.town_id = b.town_id.
    How will the update query look like?
    I tried
    UPDATE B SET town_code = (SELECT A.town_code FROM A,B WHERE A.town_id=B.town_id)
    and I get the error 'single-row subquery returns more than one row'
    Will appreciate your assistance

    This is what I did.
    First, I created and populated the TOWN_INFO table:
    CREATE TABLE "TOWN_INFO"
    (     "TOWN_ID" NUMBER,
         "TOWN_CODE" NUMBER,
         "E_MAIL" CHAR(15 BYTE)
    Table Created.
    insert all
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3024,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3040,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3052,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3065,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3066,'[email protected]')
    select * from dual
    5 rows created.
    The following creates and populates the mapping table:
    CREATE TABLE "TOWN_MAPP"
    (     "TOWN_CODE" NUMBER,
         "TOWN_ID" VARCHAR2(255 BYTE),
         "TOWN_NAME" CHAR(6 BYTE)
    insert all
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3024,'1001','TOWN_1')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3040,'1003','TOWN_3')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3052,'1002','TOWN_2')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3065,'1004','TOWN_4')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3066,'1006','TOWN_6')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3088,'1007','TOWN_7')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3020,'1009','TOWN_9')
    select * from dual
    7 rows created.
    And now the update query:
    UPDATE TOWN_INFO
    SET TOWN_CODE=(SELECT B.TOWN_CODE FROM TOWN_MAPP B, TOWN_INFO C
    WHERE B.TOWN_ID=B.TOWN_ID)
    SET TOWN_CODE=(SELECT B.TOWN_CODE FROM TOWN_MAPP B, TOWN_INFO C
    ERROR at line 2:
    ORA-01427: single-row subquery returns more than one row
    Thanx in advance
    Edited by: user9954260 on Apr 13, 2010 7:40 AM
    Edited by: user9954260 on Apr 13, 2010 7:44 AM

  • How to do a select from a table whose name is saved in a field?

    Hello,
    This is an abap report.
    I need to do a select from a table whose name is saved in a field of Z* table.
    Like this..
    SELECT * FROM znodos.
       SELECT * FROM znodos-tabla.   "znodos-tabla contain the Z* table name
           move zodos-tabla-txtmd to.....
       endselect.
    endselect.
    Is this possible??
    Thanks

    Hi Ilie Aleman 
    Give variable name in ().. Variable name refers to variable which contains table name
    SELECT * FROM (znodos-tabla).
    Regards,
    Mohaiyuddin
    Edited by: Mohaiyuddin Soniwala on Jan 22, 2008 5:18 PM

  • Select from two tables and insert into a third

    I'm trying to do a select from two tables and do an insert into a third table from the two resulting columns.
    I have the following....
    DECLARE
    tempsid number;
    temphostid number;
    BEGIN
    select "DBSID_ID","ID" into tempsid,temphostid from "DBSIDS","SERVERS"
    where "HOST_SID" like '%'||"DBSID_NAME"||'%'
    and "HOST_NAME" not like 'vio%'
    and exists (select "DBSID_NAME" from DBSIDS)
    order by "DBSID_NAME";
    insert into "DBSID_LOOKUP" ("SIDLOOKUP_ID", "SERVERLOOKUP_ID")
    values(tempsid, temphostsid);
    END;
    run;
    I get the error ....
    ORA-06550: line 11, column 18:
    PL/SQL: ORA-00984: column not allowed here
    ORA-06550: line 10, column 1:
    PL/SQL: SQL Statement ignored
    1. DECLARE
    2. tempsid number;
    3. temphostid number;

    okay ... I tried a different way ...
    DECLARE
    a number;
    b number;
    BEGIN
    select "DBSID_ID","ID" into a,b from "DBSIDS","SERVERS"
    where "HOST_SID" like '%'||"DBSID_NAME"||'%'
    and "HOST_NAME" not like 'vio%'
    and exists (select "DBSID_NAME" from DBSIDS)
    order by "DBSID_NAME";
    insert into "DBSID_LOOKUP" (SIDLOOKUP_ID, SERVERLOOKUP_ID) values (a, b);
    END;
    and now it whines about ...
    ORA-01422: exact fetch returns more than requested number of rows

  • Insert into table a (select * from table b) - need pk?

    Hi there.
    I'm going to insert into table FINAL (select * from table STAGING) - same structure but in STAGING the ID column has nulls.
    Do I need to provide the ID (primary key) for table FINAL or will it get created based on sequence/trigger?
    If I were doing this in a loop I'd get the next val from the sequence but on a simple insert, I'm curious.
    thanks!

    hmm.. what is ?
    it didn't like it.
    Error(11,4): PLS-00103: Encountered the symbol "[" when expecting one of the following:     begin case declare exit for goto if loop mod null pragma    raise return select update while with <an identifier>    <a double-quoted delimited-identifier> <a bind variable> <<    close current delete fetch lock insert open rollback    savepoint set sql execute commit forall merge    <a single-quoted SQL string> pipe
    9i, sqldeveloper                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Select from 2 tables and insert same data into 2 other tables(BPEL Process)

    Hi All,
    Please suggest me how to select from 2 tables and insert the same data into 2 tables. I am successful in selecting data from 2 tables, but i am not able to insert the same data into 2 other tables. There is foreign key constraint between 2 tables.
    Thanks in Advance,
    MAH

    I have created DB Adapter for selecting from 2 tables and also DB adapter for insert and i have created parent child relationship between 2 tables.
    I am getting this error
    <Faulthttp://schemas.xmlsoap.org/soap/envelope/>
    <faultcode>env:Server</faultcode>
    <faultstring>com.oracle.bpel.client.delivery.ReceiveTimeOutException: Waiting for response has timed out. The conversation id is 6f3fe20c1b031057:-6cc7dfb5:11b8bf5fbe1:-7fa4. Please check the process instance for detail.</faultstring>
    </Fault>

  • SELECT * cannot be used in an INSERT INTO query when the source or destination table contains a multivalued field

    Hi,
    I am using Access 2013 and I have the following VBA code, 
    strSQL = "INSERT INTO Master SELECT * from Master WHERE ID = 1"
     DoCmd.RunSQL (strSQL)
    when the SQL statement is run, I got this error.
    SELECT * cannot be used in an INSERT INTO query when the source or destination table contains a multivalued field
    Any suggestion on how to get around this?
    Please advice and your help would be greatly appreciated!

    Rather than modelling the many-to-many relationship type by means of a multi-valued field, do so by the conventional means of modelling the relationship type by a table which resolves it into two one-to-many relationship types.  You give no indication
    of what is being modelled here, so let's assume a generic model where there is a many-to-many relationship type between Masters and Slaves, for which you'd have the following tables:
    Masters
    ....MasterID  (PK)
    ....Master
    Slaves
    ....SlaveID  (PK)
    ....Slave
    and to model the relationship type:
    SlaveMastership
    ....SlaveID  (FK)
    ....MasterID  (FK)
    The primary key of the last is a composite one of the two foreign keys SlaveID and MasterID.
    You appear to be trying to insert duplicates of a subset of rows from the same table.  With the above structure, to do this you would firstly have to insert rows into the referenced table Masters for all columns bar the key, which, presuming this to be
    an autonumber column, would be assigned new values automatically.  To map these new rows to the same rows in Slaves as the original subset you would then need to insert rows into SlaveMastership with the same SlaveID values as those in Slaves referenced
    by those rows in Slavemastership which referenced the keys of the original subset of rows from Masters, and the MasterID values of the rows inserted in the first insert operation.  This would require joins to be made between the original and the new subsets
    of rows in two instances of Masters on other columns which constitute a candidate key of Masters, so that the rows from SlaveMastership can be identified.
    You'll find examples of these sort of insert operations in DecomposerDemo.zip in my public databases folder at:
    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
    In this little demo file non-normalized data from Excel is decomposed into a set of normalized tables.  Unlike your situation this does not involve duplication of rows into the same table, but the methodology for the insertion of rows into a table which
    models a many-to-many relationship type is broadly the same.
    The fact that you have this requirement to duplicate a subset of rows into the same table, however, does make me wonder about the validity of the underlying logical model.  I think it would help us if you could describe in detail just what in real world
    terms is being modelled by this table, and the purpose of the insert operation which you are attempting.
    Ken Sheridan, Stafford, England

  • How to do a SELECT from different tables into an internal table?

    How to do a SELECT from different tables into an internal table?
    I want to select data from MARA, MARC and ZPERSON and populate my ITAB_FINAL
    REPORT  zinternal_table.
    TABLES:
      mara,
      marc,
      zperson.
    TYPES:
    BEGIN OF str_table1,
      v_name LIKE zperson-zname,
      v_matnr LIKE marc-matnr,
      v_emarc LIKE marc-emarc,
      v_werks_d LIKE marc-werks_d,
      v_dstat LIKE marc-dstat,
      END OF str_table,
      i_table1 TYPE STANDARD TABLE OF str_table1.
    DATA:
    BEGIN OF str_table2,
    v_mandt LIKE mara-mandt,
    v_ernam LIKE mara-ernam,
      v_laeda LIKE mara-laeda,
    END OF str_table2,
    itab_final LIKE STANDARD TABLE OF str_table2.

    first find the link between mara , marc and zperson , if u have link to 3 tables then u can jus write a join and populate the table u want ( thats final table with all the fields).
    u defenitely have alink between mara and marc so join them and retrieve all data into one internal table.
    then for all the entries in that internal table retrieve data from zperson into another internal table.
    then loop at one internal table
    read another internal table where key equals in both the tables.
    finally assign fileds if sy-subrc = 0.
    gs_finaltable-matnr = gs_table-matnr
    etc...
    and finally append gs_finaltable to gt_finaltable.
    there u go ur final table has all the data u want.
    regards
    Edited by: BrightSide on Apr 2, 2009 3:49 PM

  • Selecting from multiple tables, into one internal table

    Hi,
    What is the best & most efficient method of selecting from multiple table (in my case 6,) into one internal table?
    Thanks,
    John
    Points will be rewarded and all responses will be highly appreciated.

    I have simple example :
    First one - Join 5 tables
    data : f1 type i,
              f2 type i,
              f3 type i.
    start-of-selection.
    get run time field f1.
    write the query 4 or 5 tables join.
    get run time field f2.
    f3 = f2 - f1 ( Total time).
    Second one - joins 3 table and use for all entries
    data : f1 type i,
              f2 type i,
              f3 type i.
    start-of-selection.
    get run time field f1.
    write the query 3 tables join and use for all entries
    get run time field f2.
    f3 = f2 - f1. ( Total time )
    Finally you can have time diffrence between the both sql statement.

  • How to insert into a table in database1 from a table in database2?

    hi!
    how to insert into a table in database1 from a table in
    database2?
    can anyone help?
    Tariq.

    using the EXEC_SQL package.
    see form help for detail.
    Regards.

  • Copy all tables and data from remote schema to local schema

    Hi,
    I am using Oracle 10g Enterprise edition as a database and Windows 7 as the operating system.
    My Requirement is to copy all the tables and data from remote machine database to my local machine.
    I created a DB link between my location schema and remote machine schema. Database link created successful. Error what i am getting when i am trying to import all the tables from the remote data is as mentioned below
    I created a directory gave all the privilege to do read and write on the directory.
    Directory name : DUMP
    Local Schema name / PASSWORD : PRODUCTION / PRODUCTION
    Remote Schema name / Password : portal / m3892!2
    When i run this scrip from command prompt
    impdp PRODUCTION/PRODUCTION DIRECTORY=DUMP LOGFILE=LOCALPROD_MERUPROD.log network_link=MERU_DEV_LOCAL_PROD schemas=portal remap_schema=portal:PRODUCTION TABLE_EXISTS_ACTION=REPLACE
    It is giving me following error please suggest me what is the mistake i couldn't trace
    ORA-31631: privileges are required
    ORA-39149: cannot link privileged user to non-privileged user
    Thanks
    Sudhir

    Thanks I gave the grant permission for the "portal" remote user. I didn't not get the error. Issue am facing now is I need to copy the entire schema of production to my local system production.
    I am currently using the below script to copy. it not working. what might be the reason there is no error message coming but still i don't see any tables in my local system after executing this script
    impdp PRODUCTION/PRODUCTION DIRECTORY=DUMP LOGFILE=LOCALPROD_MERUPROD.log network_link=MERU_DEV_LOCAL_PROD schemas=portal remap_schema=portal:PRODUCTION TABLE_EXISTS_ACTION=REPLACE
    Or suggest me some other script to copy all the tables and procedure function from remote database to my local database using impdp script
    Thanks
    Sudhir

  • Select from nested table in a nested table security problem

    please help
    running Oracle 9.2.0.3.0 on RH AS 2.1
    I can select the inner most nested table as the creator, but can't use the same select statement as USER2.
    ORA-00942: table or view does not exist
    -- begin make of objects and tables
    create or replace type mydata_t as object ( x float, y float);
    create or replace type mydata_tab_t as table of mydata_t;
    create or replace type mid_t as object (
         graphname varchar2(12),
         datapoints mydata_tab_t );
    create or replace type mid_tab_t as table of mid_t;
    create or replace type top_t as object (
         someinfo int,
         more_mid     mid_tab_t );
    create table xyz (
         xyzPK int,
         mainstuff     top_t )
         nested table mainstuff.more_mid store as mid_nt_tab
              (nested table datapoints store as mydata_nt_tab)
    -- grants
    grant all on mydata_t to user2;
    grant all on mydata_tab_t to user2;
    grant all on mid_t to user2;
    grant all on mid_tab_t to user2;
    grant all on top_t to user2;
    grant all on xyz to user2;
    -- insert
    insert into xyz values (1, top_t(22,mid_tab_t(mid_t('line1',mydata_tab_t(
    mydata_t(0,0),
    mydata_t(15,15),
    mydata_t(30,30))))));
    commit;
    -- select fails as user2
    select * from table(select Y.datapoints as DP_TAB
         from table(select X.mainstuff.more_mid as MORE_TAB
              from scott.xyz X
              where X.xyzPK=1) Y
         where Y.graphname='line1') Z;
    -- select works as user2, but i need individual lines
    select Y.datapoints as DP_TAB
         from table(select X.mainstuff.more_mid as MORE_TAB
              from scott.xyz X
              where X.xyzPK=1) Y
         where Y.graphname='line1';

    Thank you for your reply.
    I have tried
    select value(t) from table t;
    but it is still not working. I got almost the same answer as before.
    Anyway thank you very much again.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by MARCELO OCHOA ([email protected]):
    Originally posted by meimei wu ([email protected]):
    [b]I created a nested object-relational table using REF type in oracle8i. when I tried to select * from the table, I got lots of number as the ref type values, but actually, the value in ref type should be of type varchar2 and number. The number I got looked like following code:
    JARTICLE_REF_TYPE(000022020876108427C2FE0D00E0340800208FD71F76103B99B12009C0E0340800208FD71F,
    Does anyone know how I can get the actual value that I inserted into the nested table?
    your help is appreciated.<HR></BLOCKQUOTE>
    Try this:
    select value(t) from table t;
    Best regards, Marcelo.
    null

Maybe you are looking for

  • DV7-5090eo Help! "ghost" laptop

    Hi. First of all, Sorry for my poor english I need some help. i dont get the help i need trew hp and no retailer of spare parts know my model here in sweden. Could someone please tell me witch back cover model fits my DV7-5090eo?? Ive been looking al

  • How can I uninstall Mountain Lion?

    Unfortunately, I've downloaded and installed ML yesterday and now my safari is very slow in opening pages and I can not open iPhoto.  I wish to revert back to the Lion OS.  

  • Adding fiedls in VA05 output list

    Hi, I want add some fields in VA05 output list , please help in this regard. Netaji.B

  • How do you replace a color with transparency in Elements 12?

    I've gotten this far but is there any way to make it so that I just have the black drawing with the white background transparent? I am going to put the drawing over another image so obviously I need to get rid of the white!

  • Cannot download iTunes software onto my new Sony Vaio

    My previous Vaio broke, so I bought a new one, with Windows 7. The iTunes version 10 simply wont download, its nothing to do with pop up blocker