update alternate 2 records with repeating values

P J S

Member

Hi,

I am using oracle 10g.

I have 2 tables
1.
costomer_complaints table
customer_id complaint_id engineer_id
1001 5001 15
1002 5002 15
1003 5003 15
1004 5004 15
1005 5005 15
1006 5006 15
1007 5007 15
1008 5008 15
1009 5009 15
1010 5010 15

2.
SELECT jr_engineer_id FROM TIM_emp where engineer_id=15;
20
21
Required output
I want to update costomer_complaints table as described below.
customer_id complaint_id engineer_id
1001 5001 20
1002 5002 20
1003 5003 21
1004 5004 21
1005 5005 20
1006 5006 20
1007 5007 21
1008 5008 21
1009 5009 20
1010 5010 20

I tried to write cursor within a cursor to get it implemented, but it is not working.
Can you please help me with this?

--P J S

 
As a New Year present from snowy Siberia, yes ;-)

update costomer_complaints set
engineer_id= 20+mod(round((customer_id-1000+2)/2),2)
where customer_id between 1001 and 1010

 
I cant see the exact pattern.

What result should be in that case:

SELECT jr_engineer_id FROM TIM_emp where engineer_id=15;
75
76
80
 
Back
Top