[askdba] UPDATE SQL

  • From: Chirag DBA <ChiragDBA@xxxxxxxxx>
  • To: askdba@xxxxxxxxxxxxx, "oracle-l@xxxxxxxxxxxxx" <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 13 Oct 2004 16:47:01 +0530

Hi Friends, 

I wanna update values of SP_TYPE_CD in PROFILE_CUSTOMERS which has a
VALUES and I wanna put the SP_TYPE_CD from PROFILE_SP_TYPE_CD.

PROFILE_SP_TYPE_CD  is a master table and PROFILE_CUSTOMERS is a child table. 

I have written the following query.

update profile_customers  set SP_TYPE_CD = PROFILE_SP_TYPE_CD.SP_TYPE_CD  
where profile_customers.sp_type_cd = profile_sp_type_cd.sp_type_name;

I don wanna run seperate queries for each row in PROFILE_SP_TYPE_CD.
Cause my PROFILE_CUSTOMERS have more than 50000 records and this will
be the pump running every nite.

Can I update that in a single SQL Statement?

 - Chiku

Other related posts: