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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update statement Oracle 1

Status
Not open for further replies.

Zargo

Programmer
Mar 21, 2005
109
Hi all,

I want to update two columns, it doesnt work what do i wrong?

update supplier_data set a.supplier_num = b.supplier_num_new, a.comp_no = b.comp_no_new from supplier_conversion b, supplier_data a where a.supplier_num = b.SUPPLIER_NUM_OLD and a.comp_no = b.comp_no_old


TIA,

Zargo
 
Hi

Are you coming from PostgreSQL ? Because Oracle has no [tt]from[/tt] clause for the [tt]update[/tt] command. You have to use one or more sub-[tt]select[/tt]s.

Feherke.
 
Hi,

This is a standard Oracle9i query what i want to execute. Do you know how i must write the query?

Thanx a lot
 
Code:
update supplier_data a
set (supplier_num, comp_no) = (select b.supplier_num_new, b.comp_no_new 
from supplier_conversion b
where a.supplier_num = b.SUPPLIER_NUM_OLD and 
a.comp_no = b.comp_no_old)
where exists
(select 1
from supplier_conversion b
where a.supplier_num = b.SUPPLIER_NUM_OLD and 
a.comp_no = b.comp_no_old)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top