Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Problem With Updates Using Joins
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
![]() |
![]() |