Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

how to update following data ???

Santosh.MinupureyMay 17 2010 — edited May 21 2010
i have 2 tables table A nd table B
i need to update content from table A to table B having following data


Table A Structure & Data (Table B structure is also same as B)
-----------------------------------
SQL> DESC A

EMPID NUMBER(3)
MONTH VARCHAR2(6)
GRADE VARCHAR2(1)
AMOUNT NUMBER

EMPID MONTH GRADE AMOUNT
-----------------------------------------------------------------
111 012007 A 100
111 042007 B 200
111 072007 C 300
222 062007 A 200
222 082007 B 400
222 112007 C 600


Table B contains complete data as (example for empid 111)

EMPID MONTH GRADE AMOUNT
-----------------------------------------------------------------
111 012007 x 50
111 022007 x 50
111 032007 x 50
111 042007 y 60
111 052007 x 50
111 062007 x 50
111 072007 x 50
111 082007 y 60
111 092007 z 65
222 062007 x 50
222 072007 x 50
222 082007 x 50
222 092007 y 60
222 102007 x 50
222 112007 x 50
222 122007 x 50
222 012008 y 60


output
----------
EMPID MONTH GRADE AMOUNT
-----------------------------------------------------------------
111 012007 A 100
111 022007 A 100
111 032007 A 100
111 042007 B 200
111 052007 B 200
111 062007 B 200
111 072007 C 300
111 082007 C 300
111 092007 C 300
222 062007 A 200
222 072007 A 200
222 082007 B 400
222 092007 B 400
222 102007 B 400
222 112007 C 600
222 122007 C 600
222 012008 C 600




so now i need to update Table B with Table A data

for example in Table A foe emp id has 3 records

so for 1st month in Table A (i.e 012007) i need to update grade and amount in table B w.r.t table A
this update should be done for all records until 2nd record in table A (i.e 012007,022007,032007)
i.e for months from 012007 to 032007 in table B the grade and amount to be update

2nd record in table A(empid 111) is 042007

so in table B from months 042007 to 062007 2nd record data to be updated



Regards,
Santosh Minupurey
This post has been answered by Aketi Jyuuzou on May 17 2010
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 18 2010
Added on May 17 2010
6 comments
1,514 views