Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

Update table

SOLVED
Go to solution
Avoiding the Red Zone
Occasional Contributor

Update table

Dear All,

I have a staging table called dept_management_stage which I have used SQL*LOADER to update the table this comprises of the following columns:

DEPT_ID
DEPT_NAME
START_DATE
END_DATE
COST_CENTER

What i want to do now is update dept_management from staging and seem to be not making progress. What I am trying to do is use 'update dept_management set dept_management = (select )' but can't seem to get the syntax to work could anyone help.

Thanks,
Angus
2 REPLIES
Sandman!
Honored Contributor
Solution

Re: Update table

Column name in UPDATE stmt. is same as table name. Change that to:

update dept_management
set DEPT_ID = (
select dept_id
from dept_management_stage)
/
spex
Honored Contributor

Re: Update table

Hi Angus,

Something like...

UPDATE dept_management dm
SET (dept_id, dept_name, start_date, end_date, cost_center) =
(
SELECT dept_id, dept_name, start_date, end_date, cost_center
FROM dept_management_stage dms
WHERE dms.dept_id = dm.dept_id
);

?

PCS