Join update...

Hi friends,

I need help with update...

We need to update pc_fname and pc_lname in Code_P table temp_tab according to the conditions below:

Where pc_edid = pi_edid and p_sync = t_sync

where t_ref_no is not null.

[code]

create table p)

pi_edid number (20).

p_sync varchar2 (30)

);

create table temp_tab)

t_fname VARCHAR2 (255),

t_lname VARCHAR2 (255),

t_sync varchar2 (30),

t_ref_no VARCHAR2 (255)

);

create table Code_P)

pc_fname VARCHAR2 (255),

pc_lname varchar (255),

pc_edid number (20)

);

insert into a values (12, '123456') p;

insert into a values (30, '7890') p;

insert into values of p (70, '6356');

insert into temp_tab values ('John', 'Smith', ' 123456', ' 500');

insert into temp_tab values ('Mary', 'Aaron', '7890', '100');

insert into temp_tab values (' Lewis', 'Staff', 6356', "");

insert into Code_P values ('Tim', 'Henry', 12);

insert into Code_P values ('Keith', 'Bull', 30);

insert into Code_P values ('Robert', 'Clark', 70);

After the update, Code_P should be:

'John', 'Smith', 12

'Mary', 'Aaron', 30

'Robert', 'Clark', 70

[/ code]

Help, please... Thank you very much

Add a "where" clause to your update

for example

where exists (select null from temp_tab t, p IP where...)

Tags: Database

Similar Questions

  • By joining update query

    I need to update on the column in the table as T1 based on the column of table T2, for example

    T1

    col_1, col_2, col_3

    T2

    col_1, col_2, col_3

    I need to update T1 col_3 by joining T1 and T2 and the updated value is on T1 col_3

    Select * from T1, T2 b

    where a.col_1 = b.col_2

    and a.col_2 = b.col_2

    something like below, but I know under query is false, I just wanted to understand

    Update T1 set col_3 = b.col_3 where

    a.col_1 = b.col_2

    and a.col_2 = b.col_2

    Hello

    944524 wrote:

    I need to update on the column in the table as T1 based on the column of table T2, for example

    T1

    col_1, col_2, col_3

    T2

    col_1, col_2, col_3

    I need to update T1 col_3 by joining T1 and T2 and the updated value is on T1 col_3

    Select * from T1, T2 b

    where a.col_1 = b.col_2

    and a.col_2 = b.col_2

    something like below, but I know under query is false, I just wanted to understand

    Update T1 set col_3 = b.col_3 where

    a.col_1 = b.col_2

    and a.col_2 = b.col_2

    Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

    Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

    If you ask yourself on a DML statement, such as UPDATE, then the CREATE TABLE and you post instructions INSERT must re - create the tables as they are to the DML, and the results will be the content of the or a modified tables when it's all over.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

    Maybe you want something like:

    MERGE INTO dst t1

    WITH THE HELP OF)

    SELECT t1.col_1

    t1.col_2

    t2.col_3

    FROM t1

    JOIN t2 ON t2.col_2 = t1.col_1

    AND t2.col_2 = t1.col_2

    )           src

    (Dst.col_1 = src.col_1 IN

    AND dst_col_2 = src.col_2

    )

    WHEN MATCHED THEN UPDATE

    SET dst.col_3 = src.col_3

    ;

    But, as all the rest, have that depends on your data and your needs.  What is unique in the tables?  What happens if no line in t2 is a given in t1 line?  What happens if 2 or more rows match?  You relly meant comparing the t1.col_1 and the t1.col_2 to t2.col_2?

  • ORA-01733 on update of version (view) table join

    I'm doing an update to a table with version of workspace manager (Workspace Manager replaces the table with his own point of view) using a line join view (because the merger does not display of INSTEAD of triggers). It works very well on a normal table and simple updates on the work of versioned table but when I try the join implementation update on a table with version, I get "ORA-01733: virtual column not allowed here."
    I do not understand why it gives ORA-01733 here. Can someone explain and help me get the join update to work?
    The version is 11.2.0.3

    I can use the update successfully while the table is not versioned.
    The Workspace Manager view isn't a self-join, and the column is not a function or an expression.
    I update the columns show also editable in user_updatable_columns
    I'm prototyping this for an application. I need to make large updates - there could be 10,000 rows with 80 columns updated, and I will do this for the 200 paintings, so I don't want to upgrade from postcode =(select...) set suppliers
    Here is a script to demonstrate the problem:
    create table suppliers (supplier varchar2(10) not null, postcode varchar2(10), v1 number, v2 number, v3 number, constraint suppliers_pk primary key (supplier));
    create table sup_data (supplier varchar2(10) not null, new_postcode varchar2(10), nv1 number, nv2 number, nv3 number, constraint sup_data_pk primary key (supplier));
    insert into suppliers values ('NORTH', null, 1, 2, 3);
    insert into sup_data values ('NORTH', '3000', 1.1, 2.2, 3.3);
    commit;
    update suppliers set postcode='1000', v1=0.1, v2=0.2, 
    update (select d.postcode, s.new_postcode , d.v1, d.v2, d.v3, s.nv1, s.nv2, s.nv3 from suppliers d join sup_data s on d.supplier = s.supplier)
    set postcode= new_postcode, v1 = nv1, v2 = nv2, v3 = nv3 ;
    -- That succeeded. Now try with the workspace manager versioning view.
    rollback;
    exec DBMS_WM.EnableVersioning ('suppliers', hist=> 'VIEW_WO_OVERWRITE');
    update (select d.postcode, s.new_postcode , d.v1, d.v2, d.v3, s.nv1, s.nv2, s.nv3 from suppliers d join sup_data s on d.supplier = s.supplier)
    set postcode= new_postcode, v1 = nv1, v2 = nv2, v3 = nv3 ;
    -- set postcode= new_postcode
    --     *
    -- ERROR at line 2:
    -- ORA-01733: virtual column not allowed here
    
    -- Try with an explicit view:
    create view sup_updt as select d.postcode, s.new_postcode , d.v1, d.v2, d.v3, s.nv1, s.nv2, s.nv3 from suppliers d join sup_data s on d.supplier = s.supplier;
    select * from user_updatable_columns where table_name = 'SUP_UPDT';
    
    select * from sup_updt;
    update sup_updt set postcode= new_postcode, v1 = nv1, v2 = nv2, v3 = nv3 ;
    -- update sup_updt set postcode= new_postcode, v1 = nv1, v2 = nv2, v3 = nv3
    --                     *
    -- ERROR at line 1:
    -- ORA-01733: virtual column not allowed here
     
    Thanks for your help

    Published by: davidp 2 on April 17, 2013 19:17

    Oracle development explained the ORA-1733:

    The update fails because the target (select d.postcode, s.new_postcode, d.v1, d.v2, d.v3, s.nv1, s.nv2, v_suppliers s.nv3 d join s on d.supplier = s.supplier sup_data) the update is a non merged display inline.  An update on a view must be translatable for an update on an underlying table. Thus, all the views mentioned in the update must be seen that can be merged. The same phenomenon occurs when you create instead of trigger on the view v_suppliers [was] not that can be merged, leading to the error downstream.

    For example, an (undocumented) ORA-1733 means "can not update display not merged."

  • Service pack update is stuck in the loop: 3 3 100%

    Hello.  My wife's cell phone is having this problem after trying to install Service Pack 1 for its Vista Home Premium.
    He joined 'Update 3 3 100% ', then he sits for a while before restarting the whole routine - again and again.  We tried to turn it off, and he took over just after turn it on again.  There is no error code.  Any help would be greatly appreciated.

    Hi Dave,.

    Thanks for posting on the Microsoft answers Forums

    Press and hold the power button until your pc is turned off completely.
    then while the computer is turn on before it gets to the loading windows screen, press F8 key several times until you see
    These options
    (With the arrow keys and down, choose "Last known good configuration" then press enter)
    Safe mode
    Safe mode (with networking)
    Last known good configuration<>
    .
    .
    .
    If this does not work, restart your computer. Perform the same steps, but rather start in SafeMode with network. When you're on the desktop, try to do windows updates and stop and start again. After the updates installed successfully restart computer and boot up normally this time.
    When the computer comes back again to run updates again.

    Please post back and let us know if this information was useful or if you are still needing help.

    Thank you

    Martin
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Syntax error in update statement

    Oracle 10 g database version

    Hi all

    I'm number one update command but I get the error message. I appreciate if someone help out me. Thank you

    Examples of data

    UPDATE of res rest, vic vict

    SET rest.paid_amt = 0,

    Rest.accumulated_amt = 0

    RES WHERE. V_ID = vic. V_ID

    AND vic.case_id = 111;

    Error

    SQL error: ORA-00971: lack of SET keyword

    00971 00000 - "lack the SET keyword.

    * Cause:

    * Action:

    You can also use join update, if the join is key to keeping on the table whose columns are updated, which in your case, remains. V_ID must be a foreign key pointing to vict. V_ID, because the rest columns is updated.

    UPDATE (select res.paid_amt, res.accumulated_amt, res.V_ID, vic.V_ID, vic.case_id
              from rest res, vict vic
             where res.V_ID=vic.V_ID
           )
       SET paid_amt = 0,
           accumulated_amt = 0
     WHERE case_id = 111;
    
  • How to insert a line checked several

    Hi friends,

    IM facing a scenario. Let me explain.

    I have a page with a report and a button (these two in a homepage).

    I have a tabular presentation based on a table that opens in a pop-up window by pressing a button located on the home page. In this sick in tabular form be select several lines and if I press Add button in the pop - up, then all the lines checked must insert in the table report located in the home page.

    How can I achieve this.

    Can someone help me with this problem.

    Brgds,
    Mini

    Mini,

    I've updated my example for you.

    There are several ways to accomplish what you're looking for, here are two options:
    1. make an ajax call on beforerefresh pop-up report.
    2 persists the values checked in a page element and use it instead of an array.

    In my example, I used the second option. Instead of using an item hidden, I used a text field you can see the selected values. Here are the changes I made:

    1. Add a new region and an article about her, I called my article "P33_SELECTED_WIDGETS".
    2. in the declarations of global variables in your definition of the page, add the following text:

        var pkArray = [];
    

    3. change the report query to refer to the element on the page and ensure that the State of the check box reflects the values that you have seaved in your page element.

    select
        SEQ,
        APEX_ITEM.CHECKBOX2(
          2,
          SEQ,
          'class="pk-selector" ' || SEQ_CHECK
        ) SEQ_CHECK,
        NAME,
        READY_DATE,
        COMMENTS
      from(
          select
              SEQ,
              case
                 when instr(':' || :P33_SELECTED_WIDGETS || ':',
                            ':' || SEQ || ':') > 0 then
                     'checked="checked"'
                 else ''
              end SEQ_CHECK,
              NAME,
              READY_DATE,
              COMMENTS
            from widgets_broken
    )
    

    4. create a dynamic action to manage the persistence the checked values.

    * Name: * bind_click_handler
    * Event: * after refresh
    * Type selection *: region
    * Region: *
    Real actions:
    * Seq *: 10
    * Fire on Page Load *: Yes
    * Execute JavaScript Code *:

    $('.pk-selector').bind('click',function(){
      $this = $(this);
      var checkVal = $this.val();
    
      if($this.prop("checked")){
        pkArray.push(checkVal); //save checked value
      }else{
        pkArray.splice( $.inArray(checkVal, pkArray), 1 ); //remove unchecked value
      }
      $s('P33_SELECTED_WIDGETS',pkArray.join(':')); //update page item with new values
    });
    

    Edit
    I left a decisive step. In your background report, ensure that this partial page refresh is enabled and P33_SELECTED_WIDGETS builds page elements to present the attribute.

    Finally, change the proceudure files add to refer to the page instead of globl table element.

    BEGIN
    
        insert into widgets(NAME,READY_DATE,COMMENTS)
        select name, ready_date, comments
          from widgets_broken
         where instr(':' || :P33_SELECTED_WIDGETS || ':', ':' || SEQ || ':') > 0;
    
        delete from widgets_broken
          where instr(':' || :P33_SELECTED_WIDGETS || ':', ':' || SEQ || ':') > 0;
    
        :P33_REC_CNT := SQL%ROWCOUNT;
    END;
    

    See you soon,.
    Janet Tyson

    Published by: Tyson Janet January 3, 2012 13:13

  • After updating to release 21.0, I'm more able to join a meeting by using Microsoft Lync 2010 online if Firefox is set as my default browser.

    After updating to release 21.0, I'm more able to join a meeting by using Microsoft Lync 2010 online if Firefox is set as my default browser. I am invited to "Join the meeting using your web browser" or "download and install Lync participating." None of these options work. Join using web browser results in a command prompt to install missing plugins, but then no appropriate plugins can be found. Try to install Lync Attendee fails because Lync 2010 is already installed.

    I also tried to install the beta version of Firefox 22.0, but the problem persists.

    Hello ScottRey, please try this: enter about: config in the firefox address bar (confirm the message information where it appears) and search for the preference named plugins.load_appdir_plugins. Double-click it and change its value to true (a restart of the browser may be needed later for the change to take effect). some information on the issue are explained in http://www.ghacks.net/2013/05/15/why-you-may-have-lost-access-to-plugins-or-extensions-in-firefox-21/

  • I join just plu hotmail, but I would not cancel the update.

    Original title: hotmail plus

    I join just plu hotmail, but I would not cancel the update...    I'm really sorry for my miss point. I used MasterCard payment for the service, but you can the money used for your gift.  I just need close updated.sorry always nice to know that your company is help me.thank so. my homepage is msn.thank see again you

    * E-mail address is removed from the privacy * Thank you because we use hotmail.

    After all the Hotmail issues in the appropriate forum found here:
    http://windowslivehelp.com/

  • How to manage the update/insert in display with Outer Join object?

    Hello

    I have a problem in the treatment of update/insert in the original Version that contains two EOs with right outer join. The first EO values are inserted before and I want if second values EO already exists, it will update and if not a new record created.

    Error when I commit after entering values is: ' entity line with null key is not found in SecondEO. "

    What is the solution?

    Thank you

    Hello

    Make sure that your view object, you have included the key attributes of the two entity objects.

    Kind regards

    Saif Khan.

  • Join conditions, update a table

    Hello

    I created a table of choice in the apex, so my Dispatcher column, moved to the new table. (first time doing so)

    I created again the dispatcher of the column in the first table.

    I have the following code:

    SELECT R.DISPATCHER, B.DISPATCHER

    OF GCAT_V3 R JOIN GCAT_DISPATCHER_LOOKUP B

    ON R.DISPATCHER_ID = B.DISPATCHER_ID

    DISPATCHER DISPATCHER
    -SU. [email protected]
    -SU. [email protected]
    -SU. [email protected]
    -SU. [email protected]

    I need to copy the data back.

    Basically, what I have in the column that b.Dispatcher must be copied to another column dispatcher.

    Any ideas?

    Kind regards

    Leonard

    Hi, Leonard,

    Whenever you have a question, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the accurate results you want from this data, so that people who want to help you can recreate the problem and test their ideas.

    If you ask about a DML operation, such as UPDATE, then INSERT statements, you post should show what looks like the tables before the DML, and the results will be the content of the table changed after the DML.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

    You can use the UPDATE or MERGE to copy data from a table to the existing lines in another.  For example:

    UPDATE gcat_v3 r

    SET dispactcher =)

    SELECT b.dispatcher

    OF gcat_dispatcher_lookup b

    WHERE b.dispatcher_id = r.dispatcher_id

    )

    ;

    The above statement assumes that dispatcher_id is unique in gcat_dispatcher_lookup; But there is no need to be unique in gcat_v3.

  • Update/join script to the oracle server

    Im trying to create a script using two tables in my oracle server.

    Developer SQL im trying to use these two different tables

    Table 1: conductorinfo

    Table2: calkva

    I want to join the two tables based on two fields:

    Condsize

    Condmatl

    (because the two tables have these fields) And based on these games of field, update the field conductorinfo of the table "calckva", because currently we have not these data in the conductorinfo table

    This is the script I came up with:

    UPDATE conductorinfo

    JOIN INTERNAL Calkva

    ON conductorinfo.condsize = calkva.condsize

    AND conductorinfo.condmatl = calkva.condmatl

    SET conductorinfo.calkva = calkva.calculatedkva

    WHERE conductorinfo.condsize = calkva.condsize

    AND conductorinfo.condmatl = calkva.condmatl

    Then I read this update/join cannot be used with an oracle server

    Any suggestions?

    Hello

    Here's a way you can use the MERGE:

    MERGE INTO dst conductorinfo

    With the HELP of calkva CBC

    WE (dst.condsize = src.condsize

    AND dst.condmatl = src.condmatl

    )

    WHEN MATCHED THEN UPDATE

    SET dst.calkva = dst.calculatedkva

    ;

  • At PS5 before joining CC.  After joining, I'd PSCC and PS5 to SP6 update

    Before signing for Photo CC, I had LR5 and PS5 on my computer, bought.  I join CC and LR are updated, PS CC in installed.  Also, should I receive a PS5 upgrade with the program.  It says to download but then locks up.

    Hi Ray,

    Since you have subscribed to the program creative Cloud, the latest version of Photoshop, you need to have is the version CC2015.

    You shouldn't CS6 upgrade from version CC2015 is a newer version and the current one.

    Let us know if you have any additional questions, and we would be happy to answer.

    Kind regards

    Claes

  • I can't open CS6 which I bought a few years ago. should I join a plan &amp; pay after I updated the CS6 CC?

    I can't open CS6 which I bought a few years ago. should I join a plan & pay after I updated the CS6 CC?

    I can open it now thx!

    Sent from my iPhone

  • How to install and update the vm on linux systems tools and how to join an esxi host in domain

    How to install and update the vm on linux systems tools and how to join an esxi host in domain

    thanq very much boss

  • I bought the plan for photography and still pay each month. but I can't use photoshop only after update. and they need to join a plan. How can I do? I can only use for the trial version even I never tell months.

    I bought the plan for photography 6 months ago and still pay every month.

    but I can't use photoshop only after update. and they need to join a plan.

    How can I do?

    I can only use for the same test version that I pay every month.

    Hi yejik42305752,

    Please see the following article: https://helpx.adobe.com/creative-suite/kb/trial--1-launch.html

    Kind regards

    Tanuj

Maybe you are looking for

  • I lost all the files in the Inbox 2 times. On a new system with Win 8.1

    At startup, the system goes into "repair disk" for a few minutes then start normally.The only thing that seems to be missing is files in thunderbird Inbox.The system is a k450e from Lenovo. It happened first in September about 3 weeks aftermigration

  • can you recover imovie projects in imovie 10?

    I recently deleted a project after posting to FB and then realized it was a mistake.  I'm trying to get it back, so I can fix it and wonder where will deleted projects?  It is not in my main trash, and there is no imovie trash.  Has it really gone or

  • Cannot create e800 19.ne Activesync for Vista

    Hi all! I have a problem: when I search my pc (no computer toshiba laptop but with toshiba BT) I found only the MOULD as the available record. In the Panel of bluetooth settings of vista I have 2 coms configured (one for the outgoing and one for entr

  • Printing double-sided with a 6510 Photosmart problem

    I have a Photosmart 6510 new and it is supposed to come with automatic duplex printing. I tried two-sided printing and followed the advice of many previous thread, but it did not work. I use a version of Mac OS X 10.5.8 and Microsoft Word 2008. When

  • Removed my volume controls TV

    I accidentally deleted my TV from my hp Pavilion g7-1070us Notebook PC's volume controls (windows 7).» I went from the use of the device to "use this device (enabled)" to 'do not use this device (disabled);' now I can't hear any sound when when I hav