Updating a field in multiple tables at the same time

Hi All,
I have a table with right and wrong values of a field 'id'. I want to replace the wrong values in all the tables at all_tab_columns with the right values. I did the following and it did not work. Please help.
CREATE OR REPLACE PROCEDURE Clean_ID_Proc(v_id number) IS
right_id number;
v_table_name varchar2(100);
BEGIN  
    Select correct_id into right_id from tb_id
    where wrong_id = v_id;
    FOR table_cur IN (select * from all_tab_columns
                        where column_name = 'ID')
    LOOP
      EXECUTE IMMEDIATE 'update '||table_cur.table_name||'  set id = '||right_id||' where id ='|| v_id;
    END LOOP;     
END;The error I have been getting is :
[1]: ORA-00942: table or view does not exist
[1]: ORA-06512: at "schema.CLEAN_ID_PROC", line 12
[1]: ORA-06512: at line 1
Thanks in advance

user7415666 wrote:
Hi All,
I have a table with right and wrong values of a field 'id'. I want to replace the wrong values in all the tables at all_tab_columns with the right values. I did the following and it did not work. Please help.
CREATE OR REPLACE PROCEDURE Clean_ID_Proc(v_id number) IS
right_id number;
v_table_name varchar2(100);
BEGIN  
Select correct_id into right_id from tb_id
where wrong_id = v_id;
FOR table_cur IN (select * from all_tab_columns
where column_name = 'ID')
LOOP
EXECUTE IMMEDIATE 'update '||table_cur.table_name||'  set id = '||right_id||' where id ='|| v_id;
END LOOP;     
END;The error I have been getting is :
[1]: ORA-00942: table or view does not exist
[1]: ORA-06512: at "schema.CLEAN_ID_PROC", line 12
[1]: ORA-06512: at line 1
Thanks in advancewhat is the actual table_name of the table being updated?
who owns this table?
which USER owns & runs posted code?
why did you bother populating TB_ID table instead of doing the UPDATE at that time?

Similar Messages

  • Updating single row by multiple users at the same time

    Hi,
    I have been asked to develop an application where a single row from a table will be accessed by multiple users. Even multiple users can try to update the same row at the same time. So, to provide a solution of this problem should it be the best way to lock that particular row when user requesting to update it and after completion of commit the lock will be released. In the same time if some other user request to update the same row then it will be in the wait condition.
    Please provide suggestion that is it the best way to handle the situation or not. If it is then can you also please provide an example (with sample code) of it.
    Regards,
    Koushik

    It depends entirely on how the system was built.
    You could relatively easily build an application that does something like
    - Select a row with as last_updated_date column
    - Update the row specifying the last_updated_date you had selected in your WHERE clause
    - If the update updates 1 row, it was successful, otherwise inform the user that the row was already updated.
    In this case, the second user would get an error indicating that the seat had already been purchased.
    You could also relatively easily do a SELECT FOR UPDATE to prevent users from ever getting an error between the time they select a seat and the time they finish their transaction. Of course, if the user wanders away from the computer, or inadvertently ends up locking dozens of rows, this tends to rather problematic in practice. You may find that when the train pulls out of the station, someone that never ended up buying a ticket has locked a dozen rows so you lost a dozen sales. If you have a call center where operators are reserving seats for people on the phone, you may decide that explicit locking is more appropriate because you're confident that the operators aren't going to leave tickets locked for long periods of time and the cost of having the customer walked through the seat selection process multiple times would be higher than the cost of having rows locked longer than they need to be.
    Justin

  • How to change the same cell in multiple tables at the same time

    help if you can,
    i have a workbook
    workbook has 10 sheets
    each sheet has 1 table
    when in excel you were able to select a sheet then hold control and select another, this would group the sheet as if to make them the same. change a single cell in one of the sheets and this changed cell would be also be changed in all grouped sheets. is there the same functionality in numbers?

    It's funny.
    This question was asked several times in the last ten days.
    The feature is unavailable.
    _Go to "Provide Numbers Feedback" in the "Numbers" menu_, describe what you wish.
    Then, cross your fingers, and wait _at least_ for iWork'10
    Yvan KOENIG (VALLAURIS, France) jeudi 8 octobre 2009 18:57:14

  • How to insert a UUID into multiple tables in the same form

    I am trying to insert a UUID into 2 different tables at the
    same time ie to let this be created in the form and then insert
    this ID into 2 linked tables in a database using Access.
    Does anybody have any suggestions on how to accomplish this?
    Thanks very much

    So you have one form that processes information for two
    tables, or do you
    have two forms (one for each table - except the UUID)?
    If it is one form just run two SQL insert statements. One for
    the primary
    table, then one for the related table.
    If it is two forms run the above two SQL statements then an
    update statement
    to finish filling the second table.
    Or am I completely misunderstanding the issue?
    Bryan Ashcraft (remove brain to reply)
    Web Application Developer
    Wright Medical Technology, Inc.
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) ::
    http://www.adobe.com/communities/experts/
    "weelco" <[email protected]> wrote in
    message
    news:esjtjj$qtc$[email protected]..
    > Thanks for your quick reply, and yes I do know how to do
    that however I
    > would
    > like to do this all in one form field so I would like to
    create the UUID
    > whith
    > the same form that also submits it to another table, is
    this possible or
    > do I
    > have to do that using multiple 'pages'?
    >

  • How do you insert new records into multiple tables using the same unique primary key?

    I’ve created a PHP site and MySQL server using a free app called XAMPP.  I have successfully created a form in Dreamweaver that will write data to a (name) table in the SQL database.  Here’s my question: How do you write to two (or more) tables in the same database and pass the same primary key to both tables?  In the SQL database, I defined the first field as ID and set it as the primary key with auto update.  So, when you insert a new record, it creates a unique primary key for that record.  In my form, I’m capturing info that needs to be stored to two tables at the same time; a Name table and Address table. Since the Name and Address tables use the ID field as the primary key, I believe I will need to pass the ID value from the Name table to the insert of the Address table to insure they both have the same primary key, right?

    No. You probably need the primary key from one table to be a foreign key in the other tables. In any case, I believe you can use two methods to obtain the auto generated key. First with SQL:
    http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html
    And the other using a PHP function:
    http://us3.php.net/mysql_insert_id

  • 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

  • Lightroom CC issues with multiple export at the same time

    Back before Lightroom updated to the CC version, I was able to use export presets to send 4 different versions of the photos I'm working on at the same time (A Full Size for client at certain size, full size for myself, web-sized with watermark and a thumbnail). Since updating to the CC version, I'm only able to start the export process on two of these versions before the system simply becomes crippled and I cannot even navigate through Lightroom without it chugging along.
    For reference, I'm running a 2014 rMBP with 16GB of RAM, LR is the only app open at the time and it's showing that I have roughly 6GB of RAM free when attempting this export.
    TL;DR: LR5 worked wiht multiple exports at the same time, but LRCC now chugs after 2 exports are started

    Re: "Selecting video in Messages, now starts Face time for video. Face time is one to one only."
    Apple "Messages" supports two different types of video conferencing. It's become more than a little confusing. If you (or the person on the other end) ONLY have accounts set up for Apple's "iMessage" service (associated with your Apple ID and "iCloud") you may see the video symbol, but when you click on it you will be connected via FaceTime which is limited a 1-to-1 video conference.
    However, if you have set up an AIM account in Messages (you may already have an AIM account ID if you once used iChat for video, audio and screensharing) and the person at the other end also has an AIM account you will be connected via AIM and will be able to do screen sharing and multi-person video conferences just like the old iChat, i.e. you'll have iChat Theater features, up to 4-way conferencing, etc.
    It can get very confusing if, for example, you've signed up for AIM using a .me or .cloud email address. But once you have it set up and learn to recognise the way Messages switches between AIM and iMessage all the old iChat features work just fine in Messages.

  • 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

  • How do I edit or enter values on multiple sheets at the same time in Numbers?  I can do this Excel but don't know procedure in Numbers.  Thanks.

    How do I edit or enter values on multiple sheets at the same time in Numbers?  I can do it in Excel but I don't the procedure in Numbers.  Thank you!

    The only I way I can think of to modify a single value and have that value change in multipl locations is to have all "the other places" reference a single cell.  There is not way without a referene to modify a set of cells simulateously.
    This may be something like what you want:
    Enter a value in the table "Original Data" cell A1 and the A1 cells of tables Ref1, Ref2 and Ref2-1 will change

  • In OEM 12c, how to manage multiple incidents at the same time?

    Hi,
    Is there a way to manage multiple incidents at the same time? For example, if I want to assign owner for multiple incidents in the incident manager, is there a way to do this? Thanks for the help.

    This is currently not supported. This support will be available as part of the next patch set release.
    Please note that you can use Incident rules to assign owners to incidents as they come in or get updated.

  • Can I gather object statistics on large tables at the same time?

    We have large partitioned tables to the tune of 3-4 billion rows, and they have no object statistics. Can I gather object statistics for them at the same time? For example, 4-5 large tables at the same time. I need to gather them in multiple tables because we have several of those large tables and I have to schedule the gathering carefully. So, I want to start at 4 tables. I'm wondering if gathering statistics on the above tables will be intrusive or will impact the performance while it is running.
    Alex

    What version are you running? If you are running 11g they are automatically gathered via the autotask job DBMS_STATS.GATHER_DATABASE_STATS_JOB_PROC which, depending on your window, will normally run daily at 10 pm. Im very surpised that no stats have been gathered as this collects stats on all new tables or if more than 10% of rows have been changed.
    See the following links:
    http://www.oracle-base.com/articles/11g/automated-database-maintenance-task-management-11gr1.php
    http://docs.oracle.com/cd/B28359_01/server.111/b28274/stats.htm

  • Can you use sync on multiple computers at the same time? ie have someone else logged into your firefox account for you whilst you are also logged in

    I am trying to sign up to something but there is only a short window so was going to ask a friend to sign in at the same time using my account to try to sign up (with my password being saved into my firefox account)

    Hi. Yes, you can use Sync on multiple devices at the same time. I use it to keep my bookmarks in sync across my desktop and Android versions of Firefox.

  • Is there a way to delete multiple pictures at the same time from the iphone4s?

    Is there a way to deleter multiple pictures at the same time, from my iphone4s? I know how to delete one at a time. Thanks

    Open your Photos App > Camera Roll > At the top right corner you will see a rectangle with a right arrow, select that. Now you can select as many photos as you want and you can hit the red Delete button on the bottom right.

  • CRVS2010 - open multiple rpts at the same time, like sheets in a xls file ?

    Hi all,
    is that possible to open multiple reports at the same time, like sheets in a excell file ?
    Is that possible create tabs beside the MainReport tab ? or include reports in the Group Tree ? how can I do it ?
    The application is in asp.net with VS2010 and CR2010.
    The reports used to be in excell with three sheets and now we are migrating them to crystal reports, how can I create the report with those three sheets ?
    thanks !
    Subject modified as per the sticky post at the top of this forum; [Crystal Reports for Visual Studio 2010 Beta - read before posting|Crystal Reports for Visual Studio 2010 Beta - read before posting;
    Edited by: Ludek Uher on Aug 31, 2010 7:33 AM

    I'll make the suggestion to the Program Management group.
    You may want to do a post to the [Crystal Reports Design|SAP Crystal Reports; forum and ask them how they's fake that sort of a requirement. E.g.; there may be some way to make this report look the way you want, but it will be best to ask the experts. Don't mention CRVS2010 as they don't support it and most likely you will not get an answer.
    Ludek

  • Can you opening multiple albums at the same time in Photo (not iPhoto)?

    When converting the iPhoto library to Photo most of the albums that were in place in iPhoto converted to albums in Photo . . . .but not all. Some were retained as events mainly those that were folders within an album. In order to move them to the right album I would like to have multiple albums open at the same time (side by side) so that I can make sure not to duplicate photos or move them to the wrong spot.
    I cant see how to do this, it seems that I can need to open one album and check phots and then close to look within and other and rely on memory. There must be a more efficient and accurate way to do this?

    All of the events in iPhoto were converted to albums and are located in the Folder titled iPhoto Event in the sidebar of Photos. 
    You can't open multiple albums at the same time.  You can create a smart album that will do essentially the same thing with the following criteria:
    Album is "A"
    Album is "B".
    The smart album will display all of the photos in those two albums.

Maybe you are looking for