Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access SQL update to Oracle SQL 2

Status
Not open for further replies.

jjob

Programmer
Jul 16, 2002
157
GB
I have the following Access SQL, from a Query

Code:
UPDATE User 
INNER JOIN TempUser ON User.Comp_ID = TempUser.CompID 
SET User.FirstName = [TempUser]![FirstName], User.SecondName = [TempUser]![SecondName];

I am required to convert this into an Oracle stored procedure, and wanted to maintain a single update statement, but despite various efforts, I cannot write an Oracle version that compiles. The only caveat is that I have never actually seen the Access code working, although I am told it does.

Before I abandon this, and write it using cursors in PL/SQL, can anyone suggest an Oracle translation of this statement?

TIA

John
 
If CompID is unique key for TempUser this should work:

Code:
UPDATE 
(select U.FirstName UFirstName
,T.FirstName TFirstName
, U.SecondName USecondName
, T.SecondName TSecondName
from User U, TempUser T
WHERE U.Comp_ID = T.CompID)
set UFirstName=TFirstName
,USecondName=TSecondName

Regards, Dima
 
Many thanks Dima, I've been really struggling to find out the oracle syntax for this.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top