Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    69

    Unanswered: Update query in Oracle

    I am converting some SQL Server scripts to Oracle. Here is a query in SQL Server :

    update table_name set
    a=b,
    c=d
    from table_1
    where table_name.z=table_1.z

    Equivalent oracle query :

    update table_name set
    a=(select b from table_1 where table_name.z=table_1.z),
    c=(select d from table_1 where table_name.z=table_1.z).

    Is this correct and is this an optimized way of doing this ?

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    More optimal would be:

    update table_name set (a,c) =
    (select b,d from table_1 where table_name.z=table_1.z);

Posting Permissions

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