Thanks it worked, One more question
In above example I need to update qty if the col1 and col2 exists else insert
i am planning to these 2 steps
update bigtable BT set qty = qty +
(select tm.tmpqty from tmptable tm where tm.col1 = BT.col1 and
tm.col2 = BT.col2 ) where (BT.col1 , BT.col2) in (select tm1.col1,tm1.col2 from tmptable tm1)
>> Will update any matches
Insert into bigtable BT (BT.col1, BT.col2, BT.qty) (select tm.col1, tm.col2, tm.qty from tmptable tm where (tm.col1 , tm.col2) not in (select BT1.col1,BT1.col2 from bigtable BT1 )
>> Will insert non matches
Does this look good?
Regards