Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Posts
    14

    Unanswered: Update From ....

    Hi Folks,

    this time my question is easy for professionals (i hope so).

    I want to update a field of a table. In SQL-Server, i would have done as following:

    UPDATE taskdata t SET t.start_plan = c.start_plan
    FROM view_test c
    WHERE t.caseid = c.callid

    This Command does the following: When t.caseid and c.callid have the same value, the value of t.start_plan is updated by c.start_plan.

    Please help me, what is the right Syntax for this in Oracle.

  2. #2
    Join Date
    Oct 2002
    Location
    greenwich.ct.us
    Posts
    279
    Code:
    SQL> select * from xyz;
    
            ID TXT_DATA
    ---------- --------------------
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    
    10 rows selected.
    
    SQL> select * from xyz_update_from;
    
             X TXT_UPDATE
    ---------- --------------------
             1  000000000001
             3  000000000003
             5  000000000005
             7  000000000007
             9  000000000009
    
    SQL> update xyz x
      2     set txt_data = (select txt_update from xyz_update_from u where u.x = x.id)
      3* where x.id in (select x from xyz_update_from)
    SQL> /
    
    5 rows updated.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select * from xyz;
    
            ID TXT_DATA
    ---------- --------------------
             1  000000000001
             2
             3  000000000003
             4
             5  000000000005
             6
             7  000000000007
             8
             9  000000000009
            10
    
    10 rows selected.

  3. #3
    Join Date
    Jan 2003
    Posts
    14

    Talking

    Perfect, that's what I needed. Thanks a lot :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •