Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Problem With Updates Using Joins

Problem With Updates Using Joins

From: MAnder2686 <mander2686_at_aol.com>
Date: 25 Aug 2000 17:45:23 GMT
Message-ID: <20000825134523.27693.00000371@ng-bk1.aol.com>

For years, using Sybase or MS SQL Server, I have been able to write a query that uses a join to update a table such as this:

UPDATE EMPLOYEE_NEW
SET A.SALARY = B.SALARY
FROM EMPLOYEE_NEW A, EMPLOYEE_OLD B
WHERE A.EMPLOYEE_ID = B.EMPLOYEE_ID I had always assumed this was part of standard SQL.

However, Oracle 8i give me an error stating that I have not properly termintated the SQL statement. I asked my DBA and he told me I had to re-write my query with a correlated sub query:

UPDATE EMPLOYEE_NEW A
SET A.SALARY = ( SELECT B.SALARY

                             FROM EMPLOYEE_OLD B
                             WHERE A.EMPLOYEE_ID = B.EMPLOYEE_ID )

Is this the only way to do this type of update in Oracle? It seems rather awkward compared to what I had been doing.

Thank you,

Michael A. Anderson Received on Fri Aug 25 2000 - 12:45:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US