Shutter button to copy records from one table to another;  ORA-04091:

Hello

I am trying to create a trigger that will move data from one table to the other.

I have two tables (Trial1, Trial2) two of them contains the same attributes (code, c_index)

I want to spend each new record inserted in (code Trial1) (code in Trial2)

It's my trigger:
Create or replace trigger trg_move_to_trial2
After Insert on Trial1
for each row
Start
insert into Trial2 (code)
Select: new.code of Trial1;
end;
He compiled, but when I insert a new record (the code) in (Trial1), it shows this error:
Error report:
SQL error: ORA-04091: table STU101. TRIAL1 is changing, function of triggering/can not see
ORA-06512: at "STU101. TRG_MOVE_TO_TRIAL2', line 3
ORA-04088: error during execution of trigger ' STU101. TRG_MOVE_TO_TRIAL2'
04091 00000 - "table %s.%s is changing, function of triggering/can not see.
* Cause: A trigger (or plsql user-defined function that is referenced in)
This statement) attempted to watch (or modify) a table that has been
in the Middle being modified by the statement that shot.
* Action: Rewrite the trigger (or function) so it does not read this table.
I know matter what it means error, but I did not how to fix the error.

..................................................................................................

I tried to change the (insert after on Trial1) before (insert on Trial1); It worked, but not in a good way. When I insert value in (code Trial1) new and refreshed Trial2 table, just as much as the records I have 2 test they will be duplicated. For example
Trial2
code
111
222
333
when I insert in Trial1
Trial1
code
444
Trial2 will be:
code
111
222
333
444
444
444
can you please tell me how to fix this?

Kind regards

Published by: 1002059 on April 23, 2013 17:36

You should not select Trial1 - you already have data. Simply insert this value.

Create or replace trigger trg_move_to_trial2
After insert on Trial1
for each row

begin

insert into Trial2 (code)
values (:new.code);

end; 

Kind regards
David

Tags: Database

Similar Questions

  • Insert records from one table to another table

    Hello

    I want to insert all records in table 1 which are not in table 2 in table2

    o/p
    Insert into table2
    Select * from table1
    where a.id! = b.id;

    Please let me know is there any way I can complete reviews
    insert
      into table2
      select  *
        from  table1
        where id not in (
                         select  id
                           from  table2
                        );
    

    SY.

  • How to copy columns from one table to another

    Hai All


    How to copy the contents of the array to another

    For example, first name of the table is T1 and I have 10 columns and data are here and I need to create a table T2

    But I don't need the header, but not the values of all the 10 columns of T1 to T2, but not values


    Thanks and greetings

    Srikkanth.M

    Why not?

    create table test1
    as
       select * from emp
       where 1 = 2;
    

    Kind regards.

    LOULOU.

  • How replicates all records from one table to another table without using expdp, impdp

    Hi I have two database in a database, that I have a table called t1 and another base data, I have the second table .so, my first table have records, that I need to transfer all records second T2 without use of expdp and impdp in every 5 min... what I do

    ??

    The best solution for this scenario is to use Oracle Golden Gate

    However, it requires a license, and you must pay for it.

    If this is not possible, you can create a job scheduler that uses a link DB in order to reproduce the recordings of the target database, but it will take the entire table to the target database and then INSERT AS SELECT truncate the data of the entire table every time that the job is running (because you can't follow only the records that have been changed or modified).

    In addition, read here on the replication of data using materialized views.

  • Copy from one table to another

    Is there a simple way to copy/add all the records from one table to a master table?

    INSERT INTO master_table (Field1, Field2, field3)
    SELECT field1, Field2, field3
    From other_table
    WHERE everything what

    If the data types, order and the column names are the same for both tables, then it would also work to copy all other_table lines in master_table:

    INSERT INTO master_table
    SELECT *.
    From other_table

    Phil

  • Copy data from one schema to another. Reopen the Question

    Hello

    I had asked this question earlier to copy data from tables of one schema to another in the same database using the database link. In my previous post have mentioned below.
    Re: copy data from one schema to another.
    Now I am faced with the question for the remote copy of database

    I have created a DB connection between my local system and the remote database. with the chain of connection as shown below
    CREATE THE DATABASE PUBLIC LINK "MERU_DEV_LOCAL_DEV".
    CONNECT TO MERUDEV IDENTIFIED BY MERUDEV WITH THE HELP OF "MERUPROD";
    In the above script
    LOCAL DEVELOPMENT scheme IS
    REMOTE schema is MERUDEV
    I try to copy remote database to my local database tables using the script below.
    network_link DEVELOPMENT impdp = schema MERU_DEV_LOCAL_DEV = MERUDEV remap_schema = MERUDEV:DEVELOPMENT TABLE_EXISTS_ACTION = REPLACE
    But the copy of the table does not occur. What could be the problem? Please suggest me or do I need to modify the script

    Thank you
    Sudhir

    You can:
    -monitor the BONE with ps - ef
    -monitor data pump: jobs are dba_datapump_jobs and dba_datapump_sessions
    -monitor with logops: v$ session_longops

  • copy data from one database to another

    Hello

    I want to copy data from one database to another.

    I have two patterns such as

    dev1/dev@ORCL
    DEV2/dev@DCEL


    I have same tables dev1 and dev2 (tables)
    but I have not given in dev2 (tables).
    now, I want to copy dev1 (tables) in dev2 (tables).

    You can also use the database link:

    select * from dev1.emp@orcl;
    

    What database are you connected to?
    You must create and use the links in the database for all other databases.

    For example if you are connected to the database A and to retrieve data from database B, you must create a connection of database in base B

    create database link B connect to  identified by  using 'B';
    

    Then you can retrieve data from database B with

    select * from [yourschema.]yourtable@B;
    

    This will work only for tables that are visible to the user that you used in the definition of database link.

    Published by: hm on 10.08.2011 22:15

  • Copy sheets from one workbook to another

    Hello
    Is it possible to copy sheets from one workbook to another in the same sector of activity? (discoverer more 10g v 10.1.2.55.26)
    Thank you
    Select this option.

    Hello
    It is not possible to use the most.
    It is possible to do so using the Discoverer Desktop edition.

    with office, follow these steps:
    1. connect to the discoverer desktop computer and open the workbook you want to copy from.
    2. open the workbook you want to copy.
    3. While both are open, press the "Restore down" button in the upper right area of the worksheet. (the Center button of the 3 to minimize, restore down, and close).
    4. now change the size of windows so that you will be able to see two worksheets side by side 1.
    5. place the mouse on the name of the new worksheet, press left click and drag the worksheet in the second workbook.

    You move the worksheet from one to the other, if you copy the worksheet to another workbook, and then before you start duplicate the worksheet and accomplish the foregoing on the duplicated worksheet.

    Tamir

  • When I copy something from one page to another, it seems to change text color or background, that I do not understand why he never used to do.

    When I copy something from one page to another, it seems to change text color or background, that I do not understand why he never used to do.

    Whether it's text or only a shape it changes its color to something else when I copy and paste on.

    Do you mean 'page' or 'site '?

    If you copy something from another site, the reason may be, to have different, but all also named colours on each site.

    It would be normal and causes the noticed effect.

  • Copy all the BLOBs from one table to another

    Hi all

    I hope that I put in the right place. I am trying to copy from one table to the other BLOBs, but were usuccessful. Here is the script that I wrote to do, but it just loaded a field saying not supported. Is there something I'm missing, I'm using the APEX 3.1.2.

    Thanks for your help.

    DECLARE
    number of v_id;
    v_document blob.
    v_filename varchar2 (200);
    v_mimetype varchar2 (200);



    CURSOR c_Document IS
    SELECT id, name of the document file, mimetype
    IN v_id, v_document, v_filename, v_mimetype

    OF CAB_APPEAL_ACTIONS
    WHEN THE DOCUMENT IS NOT NULL;

    BEGIN

    FOR r_Document in c_Document
    LOOP
    INSERT INTO CAB_APPEAL_DOCUMENTS
    (APPEAL_ACTION_ID,
    DOCUMENT,
    FILE NAME,
    MIMETYPE
    )
    VALUES
    (v_id,
    v_document,
    v_filename,
    v_mimetype
    );

    END LOOP;

    END;

    In addition, what is wrong with just...

    INSERT INTO CAB_APPEAL_DOCUMENTS (APPEAL_ACTION_ID,
                                      DOCUMENT,
                                      FILENAME,
                                      MIMETYPE)
       SELECT   id,
                document,
                filename,
                mimetype
         FROM   CAB_APPEAL_ACTIONS
        WHERE   DOCUMENT IS NOT NULL;
    

    APEX will end process page in a BEGIN block... END; block anyway.

    See you soon

    Ben

  • Correspondence of the columns from one table to another

    I have a database column that contains the name of a person. I have another table that has a column that contains the names separated by a comma.

    I want to match records where all records of two columns have a corresponding name. I tried this:

    < cfquery name = "MyQuery" datasource = "myds" >

    SELECT *.

    OF TBL_A

    WHERE TBL_A.customername IN (#DifferentQuery.ListOfNames #)

    < / cfquery >

    Everything that I try results in only get a recording. Basically, I want to get all records from a table where one of its columns contains the name of a column in another table.

    It's a many-to-many relationship. That is to say an editorial can be linked to many ads, and vice versa.  He is best represented with three tables. Such as:

    Table: [Editorial] column: [EditorialID (PK), EditorialText,...]

    Table: Columns of the [advertiser]: [AdvertiserID (PK), AdvertiserName]

    Table:   [Editorial_Advertisers] columns: [EditorialID, AdvertiserID]

    The name of the advertiser throw himself into a column...

    my client can decide which ads get related to which editorials

    The third table stores the relationship between ads and editorials.  So instead of storing a list of advertisers, you need to insert record for each EditorialID + AdvertiserID combination. You can then use joins to retrieve all the advertisements for EditorialID 123.

    SELECT  a.AdvertiserName
    FROM     Editorial_Advertiser ea INNER JOIN Advertiser a ON ea.AdvertiserID = a.AdvertiserID
    WHERE   ea.EditorialID = 123
    
  • copy objects from one server to another schema

    Hello.


    Oracle 11g running on multiple servers.


    Is it possible to copy tables and procedures, at the same time
    from one server to another using sqlplus?


    For example, I would like to do something like this:


    From sqlplus on server1:


    create or replace mytable from dblink_server2.mytspace.mytable;


    Any suggestions are greatly appreciated.


    Thank you.

    user652257 wrote:
    Why does in SqlPlus but not in my procedure?

    You need a direct privilege to create objects to work through the procedures or plsql.

    Grant Create Table to user1;

    HTH

    SS

  • Possible to copy templates from one application to another?

    4.2.1

    Theme 25

    Hello

    I have an application where the developer seems to have created its own model - body one tab-2 columns. Is it possible that I can use this template on my page, which is another application in the same environment? I don't see the option to copy under shared-> model components. But she copy the model of the same application.

    Also, can copy us the template from one theme to another? Or we can copy the model on the same topic only

    Thank you

    Ryan

    Yes, it is possible, but perhaps not obvious:

    1. go into shared components > models.
    2. click on create >.
    3. Select the required model type.
    4. Select a copy of a model existing.

    5. follow the rest of the wizard to identify the required application, theme and style.

  • Scheduled tasks are stored in a file that can be copied easily from one server to another?

    We have a multitude of scheduled tasks.  When moving from one server to another, we currently re-enter manually the tasks.  There are problems which the least is my strike capability.  The tasks are saved in a XML or any other file type that I could just copy from one server to the other instead of re-entering?

    Thank you!

    The file is \cfusion.ear\cfusion.war\WEB-INF\cfusion\lib\neo-cron.xml

    See also: http://helpx.adobe.com/coldfusion/kb/purpose-location-xml-configuration-files.html

  • How to do a copy / paste buttons to transfer data from one form to another

    Hi, a beginner full here.  I'm looking to create a 1 button that can copy data from a filled on adobe form, essentially the text fields and checked radio buttons, then have another 2 button that can Paste the copied data to another form, containing the same exact text fields, and radio buttons.

    Example:

    1. click on 'Copy' in formula 1

    2. click on 'Paste' in form 2

    3 fills in the data from form 1 to form 2

    example.png

    No idea how to do this?

    Here is a simple example on how to do it. Let's say you want to copy the contents of the field 'name '. In the first form you change the button copy and add a MouseUp action with a command "Run a JavaScript", that has the following code:

    overall. Name = this.getField("Name").value;

    Then, the button stick in the other file, you create the same thing, but with this code:

    If (global.name) this.getField("Name").value = global.name;

    That's it, basically...

Maybe you are looking for