Updating two tables at the same time

Please,
Does someone have an idea on how to update two tables at the same times?
Thanks a lot in advance

I was thinking about a single session and single update command.
That's why I thougth someone else could have a clue.
Thank you

Similar Messages

  • How to update two tables at the same time using jdbc

    Plz will anybody tell me what is the code or query in jdbc by which you insert entry in one table and simultaneously it goes in another table?
    Thanks in advance

    You might be
    able to design a trigger to do what you're talking
    about, but that would be a database thing, not a java
    thingAnother option would be an updatable view (google for usage), but it has limitations and should be used with caution. And yes, its a database thinggy and not java.
    cheers,
    ram.

  • Delete from two tables at the same time

    Hi,
    Is there way to delete from many tables at the same time ?
    delete from tbl1, tbl2;
    Thank you

    953402 wrote:
    Hi,
    Is there way to delete from many tables at the same time ?
    delete from tbl1, tbl2;
    Thank youNO
    Consider to actually Read The Fine Manual below
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/toc.htm

  • Changing the same column in two tables at the same time

    Hi,
    Oracle 10g2
    I have 2 tables:
    1. tab1 : Stores people info
    2. tab2 : Stores people insurance info
    Both have an address field.
    What I need to do is when tab1.address is updated I want the tab2.address to update automatically and
    when tab2.address is updated I want tab1.address to update.
    Is there a way to do this using triggers without having these triggers mutate?
    Thanks,
    Oleg
    Edited by: user635344 on Oct 8, 2009 11:04 AM

    Hi, Oleg,
    Centinul, Toon, Hoek and Peter are right. (It would be unusual if any one of them were wrong.)
    The addresses really ought to be in one table.
    If you really must have them in two (or more) tables, then don't INSERT or UPDATE addresses direectly into the tables; use a separate stored procedure, not a trigger.
    If you really must use a trigger (and this means a trigger on each table), then before each trigger updates the other table, check a flag to see if the current table is being updated because of DML on the other, and, if so, do nothing. If the current table is not being updated because of DML on the other, then set the flag before doing the update.
    In the example below, I used a package variable as the flag. You could also use a SYS_CONTEXT or a Global Temporary Table.
    CREATE TABLE tab1
    (      id    NUMBER
    ,      addr  VARCHAR2 (25)
    DROP TABLE     tab2;
    CREATE TABLE tab2
    (      id    NUMBER
    ,      addr  VARCHAR2 (25)
    CREATE OR REPLACE PACKAGE pk_x
    AS
        -- This package contains no functions or procedures, only 1 variable:
        table_of_origin     varchar2 (30);
    END     pk_x;
    CREATE OR REPLACE TRIGGER     tab1_aiu
    AFTER INSERT OR UPDATE OF addr on tab1
    FOR EACH ROW
    BEGIN
         IF  pk_x.table_of_origin  IS NULL
         THEN
              pk_x.table_of_origin := 'TAB1';
              UPDATE  tab2
              SET     addr     = :NEW.addr
              WHERE     id     = :NEW.id;
              pk_x.table_of_origin := NULL;
         END IF;
    END     tab1_aiu;
    CREATE OR REPLACE TRIGGER     tab2_aiu
    AFTER INSERT OR UPDATE OF addr on tab2
    FOR EACH ROW
    BEGIN
         IF  pk_x.table_of_origin  IS NULL
         THEN
              pk_x.table_of_origin := 'TAB2';
              UPDATE  tab1
              SET     addr     = :NEW.addr
              WHERE     id     = :NEW.id;
              pk_x.table_of_origin := NULL;
         END IF;
    END     tab1_aiu;
    /I made this example as simple as possible. Production code would be a lot more complicated (e.g., checking to see if id was changed).
    I tested this using the DML statements below.
    The contents of both tables is shown after each statement.
    INSERT INTO tab1 (id, addr) VALUES (1, '1 First St.');
          ID_1 ADDR_1                          ID_2 ADDR_2
             1 1 First St.
    INSERT INTO tab2 (id, addr) VALUES (1, 'Forstagatan 1');
          ID_1 ADDR_1                          ID_2 ADDR_2
             1 Forstagatan 1                      1 Forstagatan 1
    UPDATE        tab1
    SET        addr     = 'Primo Place'
    WHERE        id     = 1;
          ID_1 ADDR_1                          ID_2 ADDR_2
             1 Primo Place                        1 Primo PlaceThe query that displayed the contents is:
    SELECT  tab1.id           AS id_1
    ,     tab1.addr     AS addr_1
    ,     tab2.id           AS id_2
    ,     tab2.addr     AS addr_2
    FROM                tab1
    FULL OUTER JOIN           tab2     ON     tab1.id     = tab2.id
    ORDER BY   NVL (tab1.id, tab2.id);

  • How to insert into two differents tables at the same time

    Hi
    I'm newer using JDev, (version 3.1.1.2 cause the OAS seems to support just the JSP 1.0)
    and I want to insert into two differents tables at the same time using one view.
    How can I do that ?
    TIA
    Edgar

    Oracle 8i supports 'INSTEAD OF' triggers on object views so you could use a process similar to the following:
    1. Create an object view that joins your two tables. 'CREATE OR REPLACE VIEW test AS SELECT d.deptno, d.deptname, e.empname FROM DEPT d, EMP E'.
    2. Create an INSTEAD OF trigger on the view.
    3. Put code in the trigger that looks at the :NEW values being processed and determines which columns should be used to INSERT or UPDATE for each table. Crude pseudo-code might be:
    IF :NEW.deptno NOT IN (SELECT deptno FROM DEPT) THEN
    INSERT INTO dept VALUES(:NEW.deptno, :NEW.deptname);
    INSERT INTO emp VALUES (:NEW.deptno, :NEW.empname);
    ELSE
    IF :NEW.deptname IS NOT NULL THEN
    UPDATE dept SET deptname = :NEW.deptname
    WHERE deptno = :NEW.deptno;
    END IF;
    IF :NEW.empname IS NOT NULL THEN
    UPDATE emp SET empname = :NEW.empname
    WHERE deptno = :NEW.deptno;
    Try something along those lines.
    null

  • Two forms that update differrent tables on the same page?

    I tried to add two forms that update different tables on to one page.
    Problem is when I do that the forms gives me an error saying the field does not exist. It's like it is trying to update one table with the other tables fields.
    As an example Say I have one forms that is for people table and another one that is the Jobs table.
    When I go to update the people table, it sends the data for the jobs fields too I get an error like the field job description does not exist.
    I have two different forms for these and everything.
    I would hope it is possible to have two forms that update different tables on the same page.

    I was trying the exact same thing, but i managed to work round it by setting the steps to hide one region, so the user would enter the form see one region submit the region then direct back to the same page with the different region visible and the original hidden.
    I don't know if this would be acceptable for you...

  • Singletons running on two servers at the same time

    Hello,
              we faced one interesting situation with our application, running on clustered BEA Weblogic 9.2. We implemented some Singletons (ie. Singleton Service in a Weblogic cluster) and they are running fine. Most of the time.
              Common scenarios: cluster is started -> the singletons run on one server; the server is brought down -> the singletons are started on the second server.
              However, we had recently two situations where the Singletons started on both servers! Here they are:
              1) We use Database Migration Basis and we have a dedicated table for Weblogic to capture current state of the singletons. Due to the fact that database (Oracle RAC) was partially available one of the Managed Server could not get the lease and probably assumed that no singleton is running, therefore started the singletons locally.
              2) Network outage: we had several minutes where none of our servers could communicate between them (neither between SASU MS nor with the database). Consequence: each MS decided to start the singleton locally (after some time, which I assume is the waiting time). Once the network came back the servers could communicate again but the duplicate singletons are not deactivate, so they are running in parallel.
              Anyone experienced the same or similar issues? How to prevent the above? Is the Consensus Migration Basis a better choice? (I think yes for #1 but not for situation #2).
              Any helpful answer is appreciated.
              Thank you, best regards,
              Remus.

    In general its not a good idea.  Running PSConfig will try to establish a lock on the configuration database.  Doing that from two servers at the same time may cause the update to fail.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • How can I open two libraries at the same time on itunes?

    Hey i need help on opening two libraries at the same time on itunes. I don't know if that is possible but need some advice if its possible. I already have several libaries but I need to compare labaries at times due to various users on my computer. Please help .

    Not that I'm aware of. What exactly is that you want to achieve? There are tools for scanning media folders and adding any files not listed in the library, or deleting those that no longer exist. There are also ways to use one library for multiple users so that any tag update gets applied for everyone.
    tt2

  • Two tables in the same uix page

    Hi! I work with Jdeveloper and UIX with the framework Jheadstart. I need to save data of two tables at same time; i mean , two tables in the same page which save with the same submitbutton. i have made some tries editing the service file, some templates and of course the page, but sometimes it works and sometimes not, i dont know what's happening and i really need to resolve this problem urgently. i hope someone can help me and i'd thank you a lot.
    Thanks for your atention.

    I'm sorry, but I'm going to need more details before I can help. If you can provide stripped down versions of your UIX page and Java code, perhaps I can be of service. Also, I would like to know which JDeveloper and UIX versions you are using.
    Ryan Pollock
    UIX Team

  • Write a progarm to test two parts at the same time

    Hi:
    I need to write a program in LabView that is capable of testing two parts at the same time.
    Explanation:
    I star the test on a unit, once all the electrical test is done move that unit to the pressure test without loosing the current test information and continue the test of the unit thewn generate a serial number only if it passes all the test. Then while the previous unit is going thru the pressure test star testing another unit for the elecrical test and so on.
    I am using LabView 2012

    From what you have described, I agree with what has been answered above. TestStand is specifically designed for. If you would like to provide more information about your application we could give you a more detailed response. For more information about TestStand follow this link
    www.ni.com/teststand
    Ryan
    Ryan
    Applications Engineer
    National Instruments

  • Is there a way to show two angles at the same time in the final edit rather than switch between them with Multicam?

    Can I show two angles at the same time in the final edit rather than alternate with Multicam?

    Stack two clips on top of each other and reduce the sizes. I think that's what you want.

  • How to use the TableSorter for two tables at the same view?

    Hello,
    I am using the TableSorter object in order to sort Dynpro tables.
    Suppose I have two tables at the same view, is it possible to use it seperatly for both of them?
    I assume that at the wdModifyView method I will need to catch the table that the user clicked on, yet I don't have an idea of how to do it...

    Hi Roy,
    Constructor of TableSorter
    public TableSorter(IWDTable table, IWDAction sortAction, Comparator[] comparators)
    So, you have to create instance of TableSorter class for each table on the view.
    best regards, Maksim Rashchynski.

  • One again, "can I use CC on two computers at the same time?" - in practice.

    I know this has been asked before and all those threads are locked. Many asked the question, but I haven't found a satisfying answer yet.
    Can I multi task with CC?
    I want to have my laptop next to my desktop. And while I render, export or whatever my newly shot documentary on the laptop I want to work with a music video project on my desktop. Then when the render is finished I render the music video and go back to the laptop and continue on the documentary. Or maybe I just work 5 minutes on the desktop music video, then come up with something brilliant for the project on the laptop and switch. Back and forth. Will that kind of activity result in any kind of limitation, usage-wise?
    So, working on Premiere on my two computers at the same time.. is it possible? Technically? I know the EULA says "only one person". But will it let one person mutli task?
    I need to know this before I buy. sorry for asking this again, please bless me with a clear answer

    Hi Jimmy Crim,
    Yes in case of Creative cloud subscription you are allowed to install and use the cc apps in any two machines.
    Even if you want you care allowed to use these apps together in both the machines.
    Thanks
    Kapil

  • Can I access two websites at the same time?

    Does Dreamweaver have the ability to open two websites at the same time?
    I basically have a CMS hosted on one server, that connects to my clients sites on other servers. I want to be able to open files on one server and edit them and also edit files on another server at the same time.
    If this isn't available in Dreamweaver, then I think it should be. I often need to copy code from one page in a site to another page in different site. To have the ability to have two windows open, each connected to a different website server would be invaluable to me. By having separate windows, each can have its own server connection. I don't know how easy that would be, but I'd love it!
    Cheers
    Glynn

    You can only connect to one site at a time.  And you need to edit files locally, save & then upload to the remote server.   AFAIK, no single FTP app is capable of connecting to more than one server at a time.  You might be able to do what you want with DW open and an additional 3rd party FTP client like Filezilla, each connecting to different servers.
    Nancy O.

  • How can I start two Vi at the same time?

     I have two Vi's, each of these Vi has a stop button. I want to start these two Vis at the same time. I also want to be able to stop the two Vis at the same time. What should I do? Thanks.

    One way to start them is with an Invoke Node and the Run method. You can then stop them with the Set Control Value [Variant] method. When you use the Set Control Value [Variant], you just have to specify the name of the front panel control that stops the while loop. Older versions of LabVIEW only had the Set Control Value method in which you had to use the flatten to string function to pass the Type Descriptor and Flattened Data.
    Message Edited by Dennis Knutson on 03-20-200609:35 AM
    Attachments:
    Run Method.JPG ‏44 KB

Maybe you are looking for

  • Red shading behind text

    I have G71 laptop 17" that is only 4 months old.  I am seeing very light red shading behind each letter in my text.  It appears wether i am on the web or in my email.  Would this be a video card issue?

  • Http 500 internal server error unable to open CCM admin page

    When i install CCM 4.1.2 the admin page was opening without having any problems. Eventually CCM admin page is not opening. ======================================= The page cannot be displayed There is a problem with the page you are trying to reach a

  • Assert in NsDom.cpp from dbxml 2.3.8

    I was able to temporarily workaround my previous assert problems by including the function declarations inline, rather than in a separate file. That got me a little farther, but I hit another assert. Sorry if I just keep finding new ways to harp on t

  • Need to modify the existing ALE for HR to add Non-HR data to it

    Hello Experts,                     We have 2 SAP systems. System A sends data through ALE/IDOC to System B message type HRMD_ABA. Is there is a way the current system be modify to send more data from System A (table USR02, when particular field got c

  • DMEE delimiter for thousand separators in a currency field

    Hello, I want to create a new DMEE format tree that complies with a requirement of Bank of America. I use a flat file hirarchy and need to export an element declared as a currency format with the American format for currencies: 99,999,999,999.99 The